Class N
Note: This class includes codes copied from Apache Commons Lang, Google Guava and other open source projects under the Apache License 2.0. The methods copied from other libraries/frameworks/projects may be modified in this class.
ClassN is a general java utility class. It provides the most daily used operations for Object/primitive types/String/Array/Collection/Map/Bean...:
When to throw exception? It's designed to avoid throwing any unnecessary exception if the contract defined by method is not broken. for example, if user tries to reverse a
null or empty String. the input String will be
returned. But exception will be thrown if try to add element to a null Object array or collection.
An empty String/Array/Collection/Map/Iterator/Iterable/InputStream/Reader will always be a preferred choice than a
null for the return value of a method.
There are only
fromIndex/startIndex and {toIndex/endIndex} parameters in the methods defined in class CommonUtil/N, no offset/count parameters.
- Version:
- $Revision: 0.8 $ 07/03/10
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BigDecimal[]An empty immutable/unmodifiableBigDecimalarray.static final BigInteger[]An empty immutable/unmodifiableBigIntegerarray.static final boolean[]An empty immutable/unmodifiablebooleanarray.static final Boolean[]An empty immutable/unmodifiableBooleanarray.static final byte[]An empty immutable/unmodifiablebytearray.static final Byte[]An empty immutable/unmodifiableBytearray.static final Calendar[]/** An empty immutable/unmodifiableCalendararray.static final char[]An empty immutable/unmodifiablechararray.static final Character[]An empty immutable/unmodifiableCharacterarray.static final Date[]An empty immutable/unmodifiablejava.sql.Datearray.static final double[]An empty immutable/unmodifiabledoublearray.static final Double[]An empty immutable/unmodifiableDoublearray.static final float[]An empty immutable/unmodifiablefloatarray.static final Float[]An empty immutable/unmodifiableFloatarray.static final int[]An empty immutable/unmodifiableintarray.static final Integer[]An empty immutable/unmodifiableIntegerarray.static final Date[]An empty immutable/unmodifiablejava.util.Datearray.static final LocalDate[]/** An empty immutable/unmodifiableLocalDatearray.static final LocalDateTime[]/** An empty immutable/unmodifiableLocalDateTimearray.static final LocalTime[]/** An empty immutable/unmodifiableLocalTimearray.static final long[]An empty immutable/unmodifiablelongarray.static final Long[]An empty immutable/unmodifiableLongarray.static final Object[]An empty immutable/unmodifiableObjectarray.static final short[]An empty immutable/unmodifiableshortarray.static final Short[]An empty immutable/unmodifiableShortarray.static final String[]An empty immutable/unmodifiableStringarray.static final Time[]An empty immutable/unmodifiableTimearray.static final Timestamp[]An empty immutable/unmodifiableTimestamparray.static final intThe index value when an element is not found in a list or array:-1. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean[]add(boolean[] a, boolean elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static byte[]add(byte[] a, byte elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static char[]add(char[] a, char elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static double[]add(double[] a, double elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static float[]add(float[] a, float elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static int[]add(int[] a, int elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static long[]add(long[] a, long elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static short[]add(short[] a, short elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static String[]Returns a new array with elements copied from the specified array and the specified element added at the end.static <T> T[]add(T[] a, T elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static boolean[]addAll(boolean[] a, boolean... elementsToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static byte[]addAll(byte[] a, byte... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static char[]addAll(char[] a, char... elementsToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.static double[]addAll(double[] a, double... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static float[]addAll(float[] a, float... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static int[]addAll(int[] a, int... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static long[]addAll(long[] a, long... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static short[]addAll(short[] a, short... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static String[]Returns a new array with elements copied from the specified array and the specified elements added at the end.static <T> booleanaddAll(Collection<T> c, Iterable<? extends T> elementsToAdd) Adds all the elements in elementsToAdd to the given collection.static <T> booleanaddAll(Collection<T> c, Iterator<? extends T> elementsToAdd) Adds all the elements in elementsToAdd to the given collection.static <T> booleanaddAll(Collection<T> c, T... elementsToAdd) Adds all the elements in elementsToAdd to the given collection.static <T> T[]addAll(T[] a, T... elementsToAdd) Returns a new array with elements copied from the specified array and the specified elements added at the end.static booleanallBlank(CharSequence... css) Checks if all of the CharSequences are empty (""),nullor whitespace only.static booleanallBlank(CharSequence a, CharSequence b) Checks if both specified CharSequences are blank.static booleanallBlank(CharSequence a, CharSequence b, CharSequence c) Checks if all of the specified CharSequences are blank.static booleanallBlank(Collection<? extends CharSequence> css) Checks if all specified CharSequences in the collection are blank.static booleanallEmpty(CharSequence... css) Checks if all of the CharSequences are empty ("") ornull.static booleanallEmpty(CharSequence a, CharSequence b) Checks if both specified CharSequences are empty ("") ornull.static booleanallEmpty(CharSequence a, CharSequence b, CharSequence c) Checks if all of the specified CharSequences are empty ("") ornull.static booleanChecks if all specified object arrays are empty.static booleanChecks if all specified object arrays are empty.static booleanallEmpty(Collection<?> a, Collection<?> b) Checks if all specified collections are empty.static booleanallEmpty(Collection<?> a, Collection<?> b, Collection<?> c) Checks if all specified collections are empty.static booleanallEmpty(Collection<? extends CharSequence> css) Checks if all specified CharSequences in the collection are empty ornull.static booleanallFalse(boolean[] a) Checks if all elements in the input boolean array arefalse.static <T> booleanChecks if all elements in the input iterable match the given predicate.static <T> booleanChecks if all elements in the input iterator match the given predicate.static <T> booleanChecks if all elements in the input array match the given predicate.static booleanChecks if all specified objects arenull.static booleanChecks if both specified objects arenull.static booleanChecks if all specified objects arenull.static booleanallNull(Collection<?> c) Checks if all elements in the specified collection arenull.static booleanallTrue(boolean[] a) Checks if all elements in the input boolean array aretrue.static booleananyBlank(CharSequence... css) Checks if any of the CharSequences are empty ("") ornullor whitespace only.static booleananyBlank(CharSequence a, CharSequence b) Checks if any of the specified CharSequences is blank.static booleananyBlank(CharSequence a, CharSequence b, CharSequence c) Checks if any of the specified CharSequences is blank.static booleananyBlank(Collection<? extends CharSequence> css) Checks if any of the specified CharSequences in the collection is blank.static booleananyEmpty(CharSequence... css) Checks if any of the CharSequences is empty ("") ornull.static booleananyEmpty(CharSequence a, CharSequence b) Checks if any of the specified CharSequences is empty ("") ornull.static booleananyEmpty(CharSequence a, CharSequence b, CharSequence c) Checks if any of the specified CharSequences is empty ("") ornull.static booleanChecks if any of the specified arrays is empty.static booleanChecks if any of the specified arrays is empty.static booleananyEmpty(Collection<?> a, Collection<?> b) Checks if any of the specified collections is empty.static booleananyEmpty(Collection<?> a, Collection<?> b, Collection<?> c) Checks if any of the specified collections is empty.static booleananyEmpty(Collection<? extends CharSequence> css) Checks if any of the specified CharSequence objects in the collection is empty.static booleananyFalse(boolean[] a) Checks if any element in the input boolean array isfalse.static <T> booleanChecks if any element in the input iterable matches the given predicate.static <T> booleanChecks if any element in the input iterator matches the given predicate.static <T> booleanChecks if any element in the input array matches the given predicate.static booleanChecks if any element in the specified array isnull.static booleanChecks if any of the specified objects isnull.static booleanChecks if any of the specified objects isnull.static booleananyNull(Collection<?> c) Checks if any element in the specified collection isnull.static booleananyTrue(boolean[] a) Checks if any element in the input boolean array istrue.static <T> T[]asArray(T... a) Returns the input array as is.static <T> ArrayBlockingQueue<T> asArrayBlockingQueue(T... a) Returns a modifiableArrayBlockingQueuewith specified elements.static <T> ArrayDeque<T> asArrayDeque(T... a) Returns a modifiableArrayDequewith specified elements.static <T> ConcurrentLinkedDeque<T> asConcurrentLinkedDeque(T... a) Returns a modifiableConcurrentLinkedDequewith specified elements.static <T> ConcurrentLinkedQueue<T> asConcurrentLinkedQueue(T... a) Returns a modifiableConcurrentLinkedQueuewith specified elements.static <T extends Delayed>
DelayQueue<T> asDelayQueue(T... a) Returns a modifiableDelayQueuewith specified elements.static <T> Deque<T> asDeque(T... a) Returns a modifiableDequewith specified elements.static <T> LinkedBlockingDeque<T> asLinkedBlockingDeque(T... a) Returns a modifiableasLinkedBlockingDequewith specified elements.static <T> LinkedBlockingQueue<T> asLinkedBlockingQueue(T... a) Returns a modifiableLinkedBlockingQueuewith specified elements.static <K,V> Map <K, V> asLinkedHashMap(Object... a) Deprecated.static <K,V> Map <K, V> asLinkedHashMap(K k1, V v1) Returns a modifiableLinkedHashMapwith specified key and value.static <K,V> Map <K, V> asLinkedHashMap(K k1, V v1, K k2, V v2) Returns a modifiableLinkedHashMapwith specified keys/values.static <K,V> Map <K, V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3) Returns a modifiableLinkedHashMapwith specified keys/values.static <K,V> Map <K, V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns a modifiableLinkedHashMapwith specified keys/values.static <K,V> Map <K, V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns a modifiableLinkedHashMapwith specified keys/values.static <K,V> Map <K, V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a modifiableLinkedHashMapwith specified keys/values.static <K,V> Map <K, V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a modifiableLinkedHashMapwith specified keys/values.static <T> Set<T> asLinkedHashSet(T e) Returns a modifiableLinkedHashSetwith specified element.static <T> Set<T> asLinkedHashSet(T... a) Returns a modifiableLinkedHashSetwith specified elements.static <T> Set<T> asLinkedHashSet(T e1, T e2) Returns a modifiableLinkedHashSetwith the specified elements.static <T> Set<T> asLinkedHashSet(T e1, T e2, T e3) Returns a modifiableLinkedHashSetwith the specified elements.static <T> Set<T> asLinkedHashSet(T e1, T e2, T e3, T e4) Returns a modifiableLinkedHashSetwith the specified elements.static <T> Set<T> asLinkedHashSet(T e1, T e2, T e3, T e4, T e5) Returns a modifiableLinkedHashSetwith the specified elements.static <T> Set<T> asLinkedHashSet(T e1, T e2, T e3, T e4, T e5, T e6) Returns a modifiableLinkedHashSetwith the specified elements.static <T> Set<T> asLinkedHashSet(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns a modifiableLinkedHashSetwith the specified elements.static <T> LinkedList<T> asLinkedList(T e) Returns a modifiableLinkedListwith the specified element.static <T> LinkedList<T> asLinkedList(T... a) Returns a modifiableLinkedListwith specified elements.static <T> LinkedList<T> asLinkedList(T e1, T e2) Returns a modifiableLinkedListwith specified elements.static <T> LinkedList<T> asLinkedList(T e1, T e2, T e3) Returns a modifiableLinkedListwith specified elements.static <T> LinkedList<T> asLinkedList(T e1, T e2, T e3, T e4) Returns a modifiableLinkedListwith specified elements.static <T> LinkedList<T> asLinkedList(T e1, T e2, T e3, T e4, T e5) Returns a modifiableLinkedListwith specified elements.static <T> LinkedList<T> asLinkedList(T e1, T e2, T e3, T e4, T e5, T e6) Returns a modifiableLinkedListwith specified elements.static <T> LinkedList<T> asLinkedList(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns a modifiableLinkedListwith specified elements.static <T> List<T> asList(T e) Returns a modifiableListwith the specified element.static <T> List<T> asList(T... a) Returns a modifiableListwith specified elements.static <T> List<T> asList(T e1, T e2) Returns a modifiableListwith specified elements.static <T> List<T> asList(T e1, T e2, T e3) Returns a modifiableListwith specified elements.static <T> List<T> asList(T e1, T e2, T e3, T e4) Returns a modifiableListwith specified elements.static <T> List<T> asList(T e1, T e2, T e3, T e4, T e5) Returns a modifiableListwith specified elements.static <T> List<T> asList(T e1, T e2, T e3, T e4, T e5, T e6) Returns a modifiableListwith specified elements.static <T> List<T> asList(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns a modifiableListwith specified elements.static <T> List<T> asList(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8) Returns a modifiableListwith specified elements.static <T> List<T> asList(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8, T e9) Returns a modifiableListwith specified elements.static <K,V> Map <K, V> Deprecated.static <K,V> Map <K, V> asMap(K k1, V v1) Returns a modifiableMapwith the specified key and value.static <K,V> Map <K, V> asMap(K k1, V v1, K k2, V v2) Returns a modifiableMapwith the specified keys and values.static <K,V> Map <K, V> asMap(K k1, V v1, K k2, V v2, K k3, V v3) Returns a modifiableMapwith specified keys/values.static <K,V> Map <K, V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns a modifiableMapwith specified keys/values.static <K,V> Map <K, V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns a modifiableMapwith specified keys/values.static <K,V> Map <K, V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a modifiableMapwith specified keys/values.static <K,V> Map <K, V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a modifiableMapwith specified keys/values.static <T> Multiset<T> asMultiset(T... a) Returns a modifiableMultisetwith the specified elements.static <T> NavigableSet<T> asNavigableSet(T... a) Returns a modifiableNavigableSetwith specified elements.static <T> PriorityQueue<T> asPriorityQueue(T... a) Returns a modifiablePriorityQueuewith specified elements.Deprecated.Returns a modifiableMapwith a specified key/value.Returns a modifiableMapwith specified keys/values.asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3) Returns a modifiableMapwith specified keys/values.asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3, String propName4, Object propValue4) Returns a modifiableMapwith specified keys/values.asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3, String propName4, Object propValue4, String propName5, Object propValue5) Returns a modifiableMapwith specified keys/values.static <T> Queue<T> asQueue(T... a) Returns a modifiableQueuewith specified elements.static <T> Set<T> asSet(T e) Returns a modifiableSetwith the specified element.static <T> Set<T> asSet(T... a) Returns a modifiableSetwith specified elements.static <T> Set<T> asSet(T e1, T e2) Returns a modifiableSetwith the specified elements.static <T> Set<T> asSet(T e1, T e2, T e3) Returns a modifiableSetwith the specified elements.static <T> Set<T> asSet(T e1, T e2, T e3, T e4) Returns a modifiableSetwith the specified elements.static <T> Set<T> asSet(T e1, T e2, T e3, T e4, T e5) Returns a modifiableSetwith the specified elements.static <T> Set<T> asSet(T e1, T e2, T e3, T e4, T e5, T e6) Returns a modifiableSetwith the specified elements.static <T> Set<T> asSet(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns a modifiableSetwith the specified elements.static <T> Set<T> asSet(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8) Returns a modifiableSetwith the specified elements.static <T> Set<T> asSet(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8, T e9) Returns a modifiableSetwith the specified elements.static <T> List<T> asSingletonList(T e) Returns an immutable list containing only the specified element.static <K,V> Map <K, V> asSingletonMap(K key, V value) Returns an immutable map containing only the specified key-value pair.static <T> Set<T> asSingletonSet(T e) Returns an immutable set containing only the specified element.static <T> SortedSet<T> asSortedSet(T... a) Returns a modifiableSortedSetwith specified elements.static <R> ObjIterator<R> asynCall(Collection<? extends Callable<? extends R>> commands) Executes the specified commands/tasks asynchronously and immediately returns an iterator for iterating the result lazily.static <R> ObjIterator<R> asynCall(Collection<? extends Callable<? extends R>> commands, Executor executor) Executes the specified commands/tasks asynchronously by the specified executor and immediately returns an iterator for iterating the result lazily.static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command) Executes the provided command asynchronously.static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> cmd, int retryTimes, long retryIntervallInMillisInMillis, Predicate<? super Exception> retryCondition) Executes the provided command asynchronously with the specified retry logic in case of failure.static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command, long delayInMillis) Executes the provided command asynchronously with the specified delay.static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command, Executor executor) Executes the provided command asynchronously by the specified executor.static <R> List<ContinuableFuture<R>> asyncExecute(Collection<? extends Callable<R>> commands) Executes the provided a collection of commands asynchronously.static <R> List<ContinuableFuture<R>> asyncExecute(Collection<? extends Callable<R>> commands, Executor executor) Executes the provided a collection of commands asynchronously by the specified executor.static <R> ContinuableFuture<R> asyncExecute(Callable<R> command) Executes the provided command asynchronously.static <R> ContinuableFuture<R> asyncExecute(Callable<R> cmd, int retryTimes, long retryIntervallInMillisInMillis, BiPredicate<? super R, ? super Exception> retryCondition) Executes the provided command asynchronously with the specified retry logic in case of failure.static <R> ContinuableFuture<R> asyncExecute(Callable<R> command, long delayInMillis) Executes the provided command asynchronously with the specified delay.static <R> ContinuableFuture<R> asyncExecute(Callable<R> command, Executor executor) Executes the provided command asynchronously by the specified executor.static List<ContinuableFuture<Void>> asyncExecute(List<? extends Throwables.Runnable<? extends Exception>> commands) Executes the provided a list of commands asynchronously.static List<ContinuableFuture<Void>> asyncExecute(List<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) Executes the provided a list of commands asynchronously by the specified executor.static ObjIterator<Void> asynRun(Collection<? extends Throwables.Runnable<? extends Exception>> commands) Executes the specified commands/tasks asynchronously and immediately returns an iterator for iterating the result lazily.static ObjIterator<Void> asynRun(Collection<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) Executes the specified commands/tasks asynchronously by the specified executor and immediately returns an iterator for iterating the result lazily.static doubleaverage(byte... a) Calculates the average of all elements in the given array of bytes.static doubleaverage(byte[] a, int fromIndex, int toIndex) Calculates the average of all elements within the specified range in the given array of bytes.static doubleaverage(char... a) Calculates the average of all elements in the given array of characters.static doubleaverage(char[] a, int fromIndex, int toIndex) Calculates the average of all elements within the specified range in the given array of characters.static doubleaverage(double... a) Calculates the average of all elements in the given array of doubles.static doubleaverage(double[] a, int fromIndex, int toIndex) Calculates the average of all elements within the specified range in the given array of doubles.static doubleaverage(float... a) Calculates the average of all elements in the given array of floats.static doubleaverage(float[] a, int fromIndex, int toIndex) Calculates the average of all elements within the specified range in the given array of floats.static doubleaverage(int... a) Calculates the average of all elements in the given array of ints.static doubleaverage(int[] a, int fromIndex, int toIndex) Calculates the average of all elements within the specified range in the given array of ints.static doubleaverage(long... a) Calculates the average of all elements in the given array of longs.static doubleaverage(long[] a, int fromIndex, int toIndex) Calculates the average of all elements within the specified range in the given array of longs.static doubleaverage(short... a) Calculates the average of all elements in the given array of shorts.static doubleaverage(short[] a, int fromIndex, int toIndex) Calculates the average of all elements within the specified range in the given array of shorts.static BigDecimalaverageBigDecimal(Iterable<? extends BigDecimal> c) Calculates the average of the elements in the given iterable of BigDecimal.static <T> BigDecimalaverageBigDecimal(Iterable<? extends T> c, Function<? super T, BigDecimal> func) Calculates the average of the elements in the given iterable using the provided function to convert each element to a BigDecimal.static BigDecimalaverageBigInteger(Iterable<? extends BigInteger> c) Calculates the average of the elements in the given iterable of BigInteger.static <T> BigDecimalaverageBigInteger(Iterable<? extends T> c, Function<? super T, BigInteger> func) Calculates the average of the elements in the given iterable using the provided function to convert each element to a BigInteger.static <T extends Number>
doubleaverageDouble(Iterable<? extends T> c) Calculates the average of the elements in the given iterable of numbers.static <T> doubleaverageDouble(Iterable<? extends T> c, ToDoubleFunction<? super T> func) Calculates the average of the elements in the given iterable using the provided function to convert each element to a double.static <T extends Number>
doubleaverageDouble(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of the elements in the given collection of numbers.static <T> doubleaverageDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to a double.static <T extends Number>
doubleaverageDouble(T[] a) Calculates the average of the elements in the given array of numbers.static <T extends Number>
doubleaverageDouble(T[] a, int fromIndex, int toIndex) Calculates the average of the elements within the specified range in the input array of numbers.static <T> doubleaverageDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to a double.static <T> doubleaverageDouble(T[] a, ToDoubleFunction<? super T> func) Calculates the average of the elements in the given array using the provided function to convert each element to a double.static <T extends Number>
doubleaverageInt(Iterable<? extends T> c) Calculates the average of the elements in the given iterable of numbers.static <T> doubleaverageInt(Iterable<? extends T> c, ToIntFunction<? super T> func) Calculates the average of the elements in the given iterable using the provided function to convert each element to an integer.static <T extends Number>
doubleaverageInt(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of the elements within the specified range in the input collection of numbers.static <T> doubleaverageInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> func) Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to an integer.static <T extends Number>
doubleaverageInt(T[] a) Calculates the average of the elements in the given array of numbers.static <T extends Number>
doubleaverageInt(T[] a, int fromIndex, int toIndex) Calculates the average of the elements in the given array of numbers within the specified range.static <T> doubleaverageInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> func) Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to an integer.static <T> doubleaverageInt(T[] a, ToIntFunction<? super T> func) Calculates the average of the elements in the given array using the provided function to convert each element to an integer.static <T extends Number>
doubleaverageLong(Iterable<? extends T> c) Calculates the average of the elements in the given iterable of numbers.static <T> doubleaverageLong(Iterable<? extends T> c, ToLongFunction<? super T> func) Calculates the average of the elements in the given iterable using the provided function to convert each element to a long.static <T extends Number>
doubleaverageLong(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of the elements in the given collection of numbers.static <T> doubleaverageLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> func) Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to a long.static <T extends Number>
doubleaverageLong(T[] a) Calculates the average of the elements in the given array of numbers.static <T extends Number>
doubleaverageLong(T[] a, int fromIndex, int toIndex) Calculates the average of the elements within the specified range in the input array of numbers.static <T> doubleaverageLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> func) Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to a long.static <T> doubleaverageLong(T[] a, ToLongFunction<? super T> func) Calculates the average of the elements in the given array using the provided function to convert each element to a long.static intbinarySearch(byte[] a, byte valueToFind) Performs a binary search on the specified array of bytes to find the specified value.static intbinarySearch(byte[] a, int fromIndex, int toIndex, byte valueToFind) Performs a binary search on the specified range of the array of bytes to find the specified value.static intbinarySearch(char[] a, char valueToFind) Performs a binary search on the specified array of characters to find the specified value.static intbinarySearch(char[] a, int fromIndex, int toIndex, char valueToFind) Performs a binary search on the specified range of the array of characters to find the specified value.static intbinarySearch(double[] a, double valueToFind) Performs a binary search on the specified array of doubles to find the specified value.static intbinarySearch(double[] a, int fromIndex, int toIndex, double valueToFind) Performs a binary search on the specified range of the array of doubles to find the specified value.static intbinarySearch(float[] a, float valueToFind) Performs a binary search on the specified array of floats to find the specified value.static intbinarySearch(float[] a, int fromIndex, int toIndex, float valueToFind) Performs a binary search on the specified range of the array of floats to find the specified value.static intbinarySearch(int[] a, int valueToFind) Performs a binary search on the specified array of ints to find the specified value.static intbinarySearch(int[] a, int fromIndex, int toIndex, int valueToFind) Performs a binary search on the specified range of the array of ints to find the specified value.static intbinarySearch(long[] a, int fromIndex, int toIndex, long valueToFind) Performs a binary search on the specified range of the array of longs to find the specified value.static intbinarySearch(long[] a, long valueToFind) Performs a binary search on the specified array of longs to find the specified value.static intbinarySearch(short[] a, int fromIndex, int toIndex, short valueToFind) Performs a binary search on the specified range of the array of shorts to find the specified value.static intbinarySearch(short[] a, short valueToFind) Performs a binary search on the specified array of shorts to find the specified value.static intbinarySearch(Object[] a, int fromIndex, int toIndex, Object valueToFind) Performs a binary search on the specified range of the array of objects to find the specified value.static intbinarySearch(Object[] a, Object valueToFind) Performs a binary search on the specified array of objects to find the specified value.static <T extends Comparable<? super T>>
intbinarySearch(List<? extends T> list, int fromIndex, int toIndex, T valueToFind) Performs a binary search on the specified range of the list of objects to find the specified value.static <T> intbinarySearch(List<? extends T> list, int fromIndex, int toIndex, T valueToFind, Comparator<? super T> cmp) Performs a binary search on the specified range of the list of objects to find the specified value.static <T extends Comparable<? super T>>
intbinarySearch(List<? extends T> list, T valueToFind) Performs a binary search on the specified list of objects to find the specified value.static <T> intbinarySearch(List<? extends T> list, T valueToFind, Comparator<? super T> cmp) Performs a binary search on the specified list of objects to find the specified value.static <T> intbinarySearch(T[] a, int fromIndex, int toIndex, T valueToFind, Comparator<? super T> cmp) Performs a binary search on the specified range of the array of objects to find the specified value.static <T> intbinarySearch(T[] a, T valueToFind, Comparator<? super T> cmp) Performs a binary search on the specified array of objects to find the specified value.callByBatch(Iterable<? extends T> iter, int batchSize, Throwables.Function<? super List<T>, R, E> batchAction) Executes the given function on batches of elements from the provided iterable.callByBatch(Iterable<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index.callByBatch(Iterator<? extends T> iter, int batchSize, Throwables.Function<? super List<T>, R, E> batchAction) Executes the given function on batches of elements from the provided iterator.callByBatch(Iterator<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index.callByBatch(T[] a, int batchSize, Throwables.Function<? super List<T>, R, E> batchAction) Executes the given function on batches of elements from the provided array.callByBatch(T[] a, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index.static <R> List<R> callInParallel(Collection<? extends Callable<? extends R>> commands) Executes the specified collection of commands/tasks in parallel.static <R> List<R> callInParallel(Collection<? extends Callable<? extends R>> commands, Executor executor) Executes the specified collection of commands/tasks in parallel.static <R,R2> Tuple.Tuple2 <R, R2> callInParallel(Callable<R> command, Callable<R2> command2) Executes and completes the input commands in parallel.static <R,R2, R3>
Tuple.Tuple3<R, R2, R3> callInParallel(Callable<R> command, Callable<R2> command2, Callable<R3> command3) Executes the specified commands in parallel and returns a tuple containing the results.static <R,R2, R3, R4>
Tuple.Tuple4<R, R2, R3, R4> callInParallel(Callable<R> command, Callable<R2> command2, Callable<R3> command3, Callable<R4> command4) Executes the specified commands in parallel and returns a tuple containing the results.static <R,R2, R3, R4, R5>
Tuple.Tuple5<R, R2, R3, R4, R5> callInParallel(Callable<R> command, Callable<R2> command2, Callable<R3> command3, Callable<R4> command4, Callable<R5> command5) Executes the specified commands in parallel and returns a tuple containing the results.static <T> TcallUninterruptibly(Throwables.BiFunction<Long, TimeUnit, T, InterruptedException> cmd, long timeout, TimeUnit unit) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static <T> TNote: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static <T> TcallUninterruptibly(Throwables.LongFunction<? extends T, InterruptedException> cmd, long timeoutInMillis) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static <T> u.Nullable<T> castIfAssignable(Object val, com.landawn.abacus.type.Type<? extends T> targetType) Casts the given object to the specified target type if possible using the provided Type instance.static <T> u.Nullable<T> castIfAssignable(Object val, Class<? extends T> targetType) Casts the given object to the specified target type if possible.static <T extends CharSequence>
TcheckArgNotBlank(T arg, String msg) Checks if the specified charSequence argument is notnullor empty or blank, and throwsIllegalArgumentExceptionif it is.static boolean[]checkArgNotEmpty(boolean[] arg, String argNameOrErrorMsg) Checks if the specified boolean array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static byte[]checkArgNotEmpty(byte[] arg, String argNameOrErrorMsg) Checks if the specified byte array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static char[]checkArgNotEmpty(char[] arg, String argNameOrErrorMsg) Checks if the specified char array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static double[]checkArgNotEmpty(double[] arg, String argNameOrErrorMsg) Checks if the specified double array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static float[]checkArgNotEmpty(float[] arg, String argNameOrErrorMsg) Checks if the specified float array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static int[]checkArgNotEmpty(int[] arg, String argNameOrErrorMsg) Checks if the specified int array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static long[]checkArgNotEmpty(long[] arg, String argNameOrErrorMsg) Checks if the specified long array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static short[]checkArgNotEmpty(short[] arg, String argNameOrErrorMsg) Checks if the specified short array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static <T> Multiset<T> checkArgNotEmpty(Multiset<T> arg, String argNameOrErrorMsg) Checks if the specified Multiset argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static <T> T[]checkArgNotEmpty(T[] arg, String argNameOrErrorMsg) Checks if the specified Object array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.static <T extends CharSequence>
TcheckArgNotEmpty(T arg, String argNameOrErrorMsg) Checks if the specified charSequence argument isnullor empty, and throwsIllegalArgumentExceptionif it is.static bytecheckArgNotNegative(byte arg, String argNameOrErrorMsg) Checks if the specified byte argument is not negative, and throwsIllegalArgumentExceptionif it is.static doublecheckArgNotNegative(double arg, String argNameOrErrorMsg) Checks if the specified double argument is not negative, and throwsIllegalArgumentExceptionif it is.static floatcheckArgNotNegative(float arg, String argNameOrErrorMsg) Checks if the specified float argument is not negative, and throwsIllegalArgumentExceptionif it is.static intcheckArgNotNegative(int arg, String argNameOrErrorMsg) Checks if the specified int argument is not negative, and throwsIllegalArgumentExceptionif it is.static longcheckArgNotNegative(long arg, String argNameOrErrorMsg) Checks if the specified long argument is not negative, and throwsIllegalArgumentExceptionif it is.static shortcheckArgNotNegative(short arg, String argNameOrErrorMsg) Checks if the specified short argument is not negative, and throwsIllegalArgumentExceptionif it is.static <T> TcheckArgNotNull(T obj) Checks if the specified argument is notnull, and throwsIllegalArgumentExceptionif it is.static <T> TcheckArgNotNull(T obj, String errorMessage) Checks if the specified argument is notnull, and throwsIllegalArgumentExceptionif it is.static bytecheckArgPositive(byte arg, String argNameOrErrorMsg) Checks if the specified byte argument is positive, and throwsIllegalArgumentExceptionif it is not.static doublecheckArgPositive(double arg, String argNameOrErrorMsg) Checks if the specified double argument is positive, and throwsIllegalArgumentExceptionif it is not.static floatcheckArgPositive(float arg, String argNameOrErrorMsg) Checks if the specified float argument is positive, and throwsIllegalArgumentExceptionif it is not.static intcheckArgPositive(int arg, String argNameOrErrorMsg) Checks if the specified int argument is positive, and throwsIllegalArgumentExceptionif it is not.static longcheckArgPositive(long arg, String argNameOrErrorMsg) Checks if the specified long argument is positive, and throwsIllegalArgumentExceptionif it is not.static shortcheckArgPositive(short arg, String argNameOrErrorMsg) Checks if the specified short argument is positive, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean expression) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean expression, Object errorMessage) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, char p) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, char p1, char p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, char p1, double p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, char p1, int p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, char p1, long p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, char p1, Object p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, double p) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, double p1, char p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, double p1, double p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, double p1, int p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, double p1, long p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, double p1, Object p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, int p) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, int p1, char p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, int p1, double p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, int p1, int p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, int p1, long p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, int p1, Object p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, long p) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, long p1, char p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, long p1, double p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, long p1, int p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, long p1, long p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, long p1, Object p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, Object p) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, Object p1, char p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, Object p1, double p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, Object p1, int p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, Object p1, long p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, Object p1, Object p2) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidCheck if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static voidcheckArgument(boolean b, Supplier<String> errorMessageSupplier) Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.static intcheckElementIndex(int index, int size) Copied from Google Guava under Apache License v2.0 and may be modified.static intcheckElementIndex(int index, int size, String desc) Copied from Google Guava under Apache License v2.0 and may be modified.static voidChecks if the specified array not contains anynullelement, and throwsIllegalArgumentExceptionif it does.static voidcheckElementNotNull(Object[] a, String argNameOrErrorMsg) Checks if the specified array not contains anynullelement, and throwsIllegalArgumentExceptionif it does.static voidCheck if the specifiedCollectionnot contains anynullelement, and throwsIllegalArgumentExceptionif it does.static voidcheckElementNotNull(Collection<?> c, String argNameOrErrorMsg) Check if the specifiedCollectionnot contains anynullelement, and throwsIllegalArgumentExceptionif it does.static voidcheckFromIndexSize(int fromIndex, int size, int length) Checks if the specified range starting fromfromIndexwith the specifiedsizeis within the bounds of the specified length.static voidcheckFromToIndex(int fromIndex, int toIndex, int length) Checks if the specified range starting fromfromIndexand ending withtoIndexare within the bounds of the specified length.static intcheckIndex(int index, int size) Deprecated.static voidcheckKeyNotNull(Map<?, ?> m) Check if the specifiedMapnot contains anynullkey, and throwsIllegalArgumentExceptionif it does.static voidcheckKeyNotNull(Map<?, ?> m, String argNameOrErrorMsg) Check if the specifiedMapnot contains anynullkey, and throwsIllegalArgumentExceptionif it does.static intcheckPositionIndex(int index, int size) Copied from Google Guava under Apache License v2.0 and may be modified.static intcheckPositionIndex(int index, int size, String desc) Copied from Google Guava under Apache License v2.0 and may be modified.static voidcheckState(boolean expression) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean expression, Object errorMessage) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, char p) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, char p1, char p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, char p1, double p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, char p1, int p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, char p1, long p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, char p1, Object p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, double p) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, double p1, char p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, double p1, double p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, double p1, int p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, double p1, long p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, double p1, Object p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, int p) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, int p1, char p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, int p1, double p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, int p1, int p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, int p1, long p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, int p1, Object p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, long p) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, long p1, char p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, long p1, double p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, long p1, int p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, long p1, long p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, long p1, Object p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, Object p) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, Object p1, char p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, Object p1, double p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, Object p1, int p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, Object p1, long p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, Object p1, Object p2) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidCheck if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckState(boolean b, Supplier<String> errorMessageSupplier) Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.static voidcheckValueNotNull(Map<?, ?> m) Check if the specifiedMapnot contains anynullvalue, and throwsIllegalArgumentExceptionif it does.static voidcheckValueNotNull(Map<?, ?> m, String argNameOrErrorMsg) Check if the specifiedMapnot contains anynullvalue, and throwsIllegalArgumentExceptionif it does.static boolean[]clone(boolean[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static boolean[][]clone(boolean[][] original) Clone the original array and its sub arrays.static boolean[][][]clone(boolean[][][] original) Clone the original array and its sub arrays.static byte[]clone(byte[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static byte[][]clone(byte[][] original) Clone the original array and its sub arrays.static byte[][][]clone(byte[][][] original) Clone the original array and its sub arrays.static char[]clone(char[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static char[][]clone(char[][] original) Clone the original array and its sub arrays.static char[][][]clone(char[][][] original) Clone the original array and its sub arrays.static double[]clone(double[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static double[][]clone(double[][] original) Clone the original array and its sub arrays.static double[][][]clone(double[][][] original) Clone the original array and its sub arrays.static float[]clone(float[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static float[][]clone(float[][] original) Clone the original array and its sub arrays.static float[][][]clone(float[][][] original) Clone the original array and its sub arrays.static int[]clone(int[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static int[][]clone(int[][] original) Clone the original array and its sub arrays.static int[][][]clone(int[][][] original) Clone the original array and its sub arrays.static long[]clone(long[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static long[][]clone(long[][] original) Clone the original array and its sub arrays.static long[][][]clone(long[][][] original) Clone the original array and its sub arrays.static short[]clone(short[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static short[][]clone(short[][] original) Clone the original array and its sub arrays.static short[][][]clone(short[][][] original) Clone the original array and its sub arrays.static <T> TDeeply copy by: obj -> serialize -> kryo/Json -> deserialize -> new object.static <T> Tclone(T obj) Clones the given object.static <T> T[]clone(T[] original) Returns a new array that is a clone of the specified array, ornullif the original array isnull.static <T> T[][]clone(T[][] original) Clone the original array and its sub arrays.static <T> T[][][]clone(T[][][] original) Clone the original array and its sub arrays.static <T> Set<T> commonSet(Collection<? extends Collection<? extends T>> c) Returns a set containing the common elements among all the collections within the specified collection of collections.static <T> Set<T> commonSet(Collection<? extends T> a, Collection<?> b) Returns a set containing the common elements between the specified collections a and b.static intcompare(boolean[] a, boolean[] b) Compares two arrays lexicographically.static intcompare(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static intcompare(boolean a, boolean b) Compares two boolean values.static intcompare(byte[] a, byte[] b) Compares two arrays lexicographically.static intcompare(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static intcompare(byte a, byte b) Compares two byte values.static intcompare(char[] a, char[] b) Compares two arrays lexicographically.static intcompare(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static intcompare(char a, char b) Compares two char values.static intcompare(double[] a, double[] b) Compares two arrays lexicographically.static intcompare(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static intcompare(double a, double b) Compares two double values.static intcompare(float[] a, float[] b) Compares two arrays lexicographically.static intcompare(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static intcompare(float a, float b) Compares two float values.static intcompare(int[] a, int[] b) Compares two arrays lexicographically.static intcompare(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static intcompare(int a, int b) Compares two int values.static intcompare(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static intcompare(long[] a, long[] b) Compares two arrays lexicographically.static intcompare(long a, long b) Compares two long values.static intcompare(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static intcompare(short[] a, short[] b) Compares two arrays lexicographically.static intcompare(short a, short b) Compares two short values.static <T extends Comparable<? super T>>
intCompares two iterables lexicographically.static <T> intcompare(Iterable<T> a, Iterable<T> b, Comparator<? super T> cmp) Compares two iterables using the specified comparator.static <T> intcompare(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len) Compares two collections lexicographically over the specified range.static <T> intcompare(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len, Comparator<? super T> cmp) Compares two collections lexicographically over the specified range using the specified comparator.static <T extends Comparable<? super T>>
intCompares two iterators lexicographically.static <T> intcompare(Iterator<T> a, Iterator<T> b, Comparator<? super T> cmp) Compares two iterators using the specified comparator.static <T extends Comparable<? super T>>
intcompare(T[] a, int fromIndexA, T[] b, int fromIndexB, int len) Compares two arrays lexicographically over the specified range.static <T> intcompare(T[] a, int fromIndexA, T[] b, int fromIndexB, int len, Comparator<? super T> cmp) Compares two arrays lexicographically over the specified range using the specified comparator.static <T extends Comparable<? super T>>
intcompare(T[] a, T[] b) Compares two arrays lexicographically.static <T> intcompare(T[] a, T[] b, Comparator<? super T> cmp) Compares two arrays using the specified comparator.static <T1 extends Comparable<T1>,T2 extends Comparable<T2>>
intcompare(T1 a1, T1 b1, T2 a2, T2 b2) Compares two pairs of values (a1, b1) and (a2, b2) until they are not equal.static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, T3 extends Comparable<T3>>
intcompare(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3) Compares three pairs of values (a1, b1), (a2, b2), and (a3, b3) until they are not equal.static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, T3 extends Comparable<T3>, T4 extends Comparable<T4>>
intcompare(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4) Deprecated.replaced byBuilder.compare(Comparable, Comparable)static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, T3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>>
intcompare(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5) Deprecated.replaced byBuilder.compare(Comparable, Comparable)static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, T3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>, T6 extends Comparable<T6>>
intcompare(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5, T6 a6, T6 b6) Deprecated.replaced byBuilder.compare(Comparable, Comparable)static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, T3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>, T6 extends Comparable<T6>, T7 extends Comparable<T7>>
intcompare(T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5, T6 a6, T6 b6, T7 a7, T7 b7) Deprecated.replaced byBuilder.compare(Comparable, Comparable)static <T extends Comparable<? super T>>
intcompare(T a, T b) Compares twoComparableobject values.static <T> intcompare(T a, T b, Comparator<? super T> cmp) Compares twoComparableobject values using the specifiedComparator.static intcompareByProps(Object bean1, Object bean2, Collection<String> propNamesToCompare) Deprecated.callgetPropValueby reflection APIs during comparing or sorting may have a huge impact on performance.static intcompareIgnoreCase(String[] a, String[] b) Compares two arrays of strings lexicographically, ignoring case differences.static intcompareIgnoreCase(String a, String b) Compares two strings lexicographically, ignoring case differences.static intcompareUnsigned(byte[] a, byte[] b) Compares two arrays lexicographically, treating the values as unsigned.static intcompareUnsigned(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) Compares two subarrays lexicographically, treating the values as unsigned.static intcompareUnsigned(byte a, byte b) Compares two unsigned byte values.static intcompareUnsigned(int[] a, int[] b) Compares two arrays lexicographically, treating the values as unsigned.static intcompareUnsigned(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) Compares two subarrays lexicographically, treating the values as unsigned.static intcompareUnsigned(int a, int b) Compares two unsigned int values.static intcompareUnsigned(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) Compares two subarrays lexicographically, treating the values as unsigned.static intcompareUnsigned(long[] a, long[] b) Compares two arrays lexicographically, treating the values as unsigned.static intcompareUnsigned(long a, long b) Compares two unsigned long values.static intcompareUnsigned(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) Compares two subarrays lexicographically, treating the values as unsigned.static intcompareUnsigned(short[] a, short[] b) Compares two arrays lexicographically, treating the values as unsigned.static intcompareUnsigned(short a, short b) Compares two unsigned short values.static boolean[]concat(boolean[]... aa) Concatenates multiple boolean arrays into a new array.static boolean[]concat(boolean[] a, boolean[] b) Concatenates two boolean arrays into a new array.static byte[]concat(byte[]... aa) Concatenates multiple byte arrays into a new array.static byte[]concat(byte[] a, byte[] b) Concatenates two byte arrays into a new array.static char[]concat(char[]... aa) Concatenates multiple char arrays into a new array.static char[]concat(char[] a, char[] b) Concatenates two char arrays into a new array.static double[]concat(double[]... aa) Concatenates multiple double arrays into a new array.static double[]concat(double[] a, double[] b) Concatenates two double arrays into a new array.static float[]concat(float[]... aa) Concatenates multiple float arrays into a new array.static float[]concat(float[] a, float[] b) Concatenates two float arrays into a new array.static int[]concat(int[]... aa) Concatenates multiple int arrays into a new array.static int[]concat(int[] a, int[] b) Concatenates two int arrays into a new array.static long[]concat(long[]... aa) Concatenates multiple long arrays into a new array.static long[]concat(long[] a, long[] b) Concatenates two long arrays into a new array.static short[]concat(short[]... aa) Concatenates multiple short arrays into a new array.static short[]concat(short[] a, short[] b) Concatenates two short arrays into a new array.static <T> List<T> Concatenates multiple iterables into a new list.static <T> List<T> Concatenates two iterables into a new list.static <T> List<T> concat(Collection<? extends Iterable<? extends T>> c) Concatenates multiple iterables into a new list.static <T,C extends Collection<T>>
Cconcat(Collection<? extends Iterable<? extends T>> c, IntFunction<? extends C> supplier) Concatenates multiple iterables into a new collection.static <T> ObjIterator<T> Concatenates multiple iterators into a new ObjIterator.static <T> ObjIterator<T> Concatenates two iterators into a new ObjIterator.static <T> T[]concat(T[]... aa) Concatenates multiple arrays into a new array.static <T> T[]concat(T[] a, T[] b) Concatenates two arrays into a new array.static booleancontains(boolean[] a, boolean valueToFind) Checks if the specified array contains the specified value.static booleancontains(byte[] a, byte valueToFind) Checks if the specified array contains the specified value.static booleancontains(char[] a, char valueToFind) Checks if the specified array contains the specified value.static booleancontains(double[] a, double valueToFind) Checks if the specified array contains the specified value.static booleancontains(float[] a, float valueToFind) Checks if the specified array contains the specified value.static booleancontains(int[] a, int valueToFind) Checks if the specified array contains the specified value.static booleancontains(long[] a, long valueToFind) Checks if the specified array contains the specified value.static booleancontains(short[] a, short valueToFind) Checks if the specified array contains the specified value.static booleanChecks if the specifiedIterablecontains the specified value.static booleanChecks if the specified array contains the specified value.static booleancontains(Collection<?> c, Object valueToFind) Checks if the specified Collection contains the specified value.static booleanChecks if the specified Iterator contains the specified value.static booleancontainsAll(Iterable<?> c, Collection<?> valuesToFind) Checks if the givenIterablecontains all the elements in the specifiedvaluesToFindCollection.static booleancontainsAll(Collection<?> c, Object... valuesToFind) Checks if the givenCollectioncontains all the elements in the specifiedvaluesToFindarray.static booleancontainsAll(Collection<?> c, Collection<?> valuesToFind) Checks if the givenCollectioncontains all the elements in the specifiedvaluesToFindCollection.static booleancontainsAll(Iterator<?> iter, Collection<?> valuesToFind) Checks if the givenIteratorcontains all the elements in the specifiedvaluesToFindCollection.static booleancontainsAny(Iterable<?> c, Set<?> valuesToFind) Checks if the givenIterablecontains any elements from the specifiedvaluesToFindSet.static booleancontainsAny(Collection<?> c, Object... valuesToFind) Checks if the givenCollectioncontains any elements from the specifiedvaluesToFindarray.static booleancontainsAny(Collection<?> c, Collection<?> valuesToFind) Checks if the givenCollectioncontains any elements from the specifiedvaluesToFindCollection.static booleancontainsAny(Iterator<?> iter, Set<?> valuesToFind) Checks if the givenIteratorcontains any elements from the specifiedvaluesToFindSet.static booleancontainsNone(Iterable<?> c, Set<?> valuesToFind) Checks if the givenIterabledosn't contain any elements from the specifiedvaluesToFindSet.static booleancontainsNone(Collection<?> c, Object... valuesToFind) Checks if the specified givenCollectiondosn't contain any elements from the specifiedvaluesToFindarray.static booleancontainsNone(Collection<?> c, Collection<?> valuesToFind) Checks if the givenCollectiondosn't contain any elements from the specifiedvaluesToFindCollection.static booleancontainsNone(Iterator<?> iter, Set<?> valuesToFind) Checks if the givenIteratordosn't contain any elements from the specifiedvaluesToFindSet.static <T> TConverts the given source object to the specified target type using the provided Type instance.static <T> TConverts the given source object to the specified target type.static voidcopy(boolean[] src, int srcPos, boolean[] dest, int destPos, int length) Copies elements from the source boolean array to the destination boolean array.static voidcopy(byte[] src, int srcPos, byte[] dest, int destPos, int length) Copies elements from the source byte array to the destination byte array.static voidcopy(char[] src, int srcPos, char[] dest, int destPos, int length) Copies elements from the source char array to the destination char array.static voidcopy(double[] src, int srcPos, double[] dest, int destPos, int length) Copies elements from the source double array to the destination double array.static voidcopy(float[] src, int srcPos, float[] dest, int destPos, int length) Copies elements from the source float array to the destination float array.static voidcopy(int[] src, int srcPos, int[] dest, int destPos, int length) Copies elements from the source int array to the destination int array.static voidcopy(long[] src, int srcPos, long[] dest, int destPos, int length) Copies elements from the source long array to the destination long array.static voidcopy(short[] src, int srcPos, short[] dest, int destPos, int length) Copies elements from the source short array to the destination short array.static voidCopies elements from the source array to the destination array.static <T> Tcopy(Object sourceBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames, Class<? extends T> targetType) Returns a new instance of specifiedtargetTypewith properties copied from the given source bean, except the properties specified in theignoredPropNamesset.static voidCopies elements from the source array to the destination array.static <T> TReturns a new instance of specifiedtargetTypewith properties copied from the given source bean.static <T> Tcopy(Object sourceBean, Collection<String> selectPropNames, Class<? extends T> targetType) Returns a new instance of specifiedtargetTypewith properties copied from the given source bean with selected properties.static <T> Tcopy(Object sourceBean, Collection<String> selectPropNames, Function<String, String> propNameConverter, Class<? extends T> targetType) Returns a new instance of specifiedtargetTypewith properties copied from the given source bean with selected properties.static <T> Tcopy(Object sourceBean, BiPredicate<? super String, ?> propFilter, Class<? extends T> targetType) Returns a new instance of specifiedtargetTypewith properties copied from the given source bean, filtered by the specified predicate.static <T> Tcopy(Object sourceBean, BiPredicate<? super String, ?> propFilter, Function<String, String> propNameConverter, Class<? extends T> targetType) Returns a new instance of specifiedtargetTypewith properties copied from the given source bean, filtered by the specified predicate.static <T> voidCopies a portion of one list into another.static <T> voidCopies all of the elements from the source list into the destination list.static <T> Tcopy(T sourceBean) Returns a copy of the given source bean.static <T> Tcopy(T sourceBean, Collection<String> selectPropNames) Returns a copy of the given source bean with selected properties.static <T> Tcopy(T sourceBean, BiPredicate<? super String, ?> propFilter) Returns a copy of the given source bean with properties filtered by the specified predicate.static boolean[]copyOf(boolean[] original, int newLength) Returns a new boolean array containing a copy of the original array, truncated or padded withfalse(if necessary) so the copy has the specified length.static byte[]copyOf(byte[] original, int newLength) Returns a new byte array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.static char[]copyOf(char[] original, int newLength) Returns a new char array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.static double[]copyOf(double[] original, int newLength) Returns a new double array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.static float[]copyOf(float[] original, int newLength) Returns a new float array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.static int[]copyOf(int[] original, int newLength) Returns a new int array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.static long[]copyOf(long[] original, int newLength) Returns a new long array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.static short[]copyOf(short[] original, int newLength) Returns a new short array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.static <T> T[]copyOf(T[] original, int newLength) Returns a new Object array containing a copy of the original array, truncated or padded withnull(if necessary) so the copy has the specified length.static <T,U> T[] Returns a new array containing a copy of the original array, truncated or padded withnull(if necessary) so the copy has the specified length.static boolean[]copyOfRange(boolean[] original, int fromIndex, int toIndex) Returns a new boolean array containing a copy of the specified range of the original array.static boolean[]copyOfRange(boolean[] original, int fromIndex, int toIndex, int step) Returns a new boolean array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static byte[]copyOfRange(byte[] original, int fromIndex, int toIndex) Returns a new byte array containing a copy of the specified range of the original array.static byte[]copyOfRange(byte[] original, int fromIndex, int toIndex, int step) Returns a new byte array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static char[]copyOfRange(char[] original, int fromIndex, int toIndex) Returns a new char array containing a copy of the specified range of the original array.static char[]copyOfRange(char[] original, int fromIndex, int toIndex, int step) Returns a new char array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static double[]copyOfRange(double[] original, int fromIndex, int toIndex) Returns a new double array containing a copy of the specified range of the original array.static double[]copyOfRange(double[] original, int fromIndex, int toIndex, int step) Returns a new double array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static float[]copyOfRange(float[] original, int fromIndex, int toIndex) Returns a new float array containing a copy of the specified range of the original array.static float[]copyOfRange(float[] original, int fromIndex, int toIndex, int step) Returns a new float array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static int[]copyOfRange(int[] original, int fromIndex, int toIndex) Returns a new int array containing a copy of the specified range of the original array.static int[]copyOfRange(int[] original, int fromIndex, int toIndex, int step) Returns a new int array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static long[]copyOfRange(long[] original, int fromIndex, int toIndex) Returns a new long array containing a copy of the specified range of the original array.static long[]copyOfRange(long[] original, int fromIndex, int toIndex, int step) Returns a new long array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static short[]copyOfRange(short[] original, int fromIndex, int toIndex) Returns a new short array containing a copy of the specified range of the original array.static short[]copyOfRange(short[] original, int fromIndex, int toIndex, int step) Returns a new short array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static StringcopyOfRange(String str, int fromIndex, int toIndex) Returns a new string that is a substring of the specified string.static StringcopyOfRange(String str, int fromIndex, int toIndex, int step) Returns a new string that is a substring of the specified string, with characters selected at intervals defined by the step parameter.static <T> List<T> copyOfRange(List<T> c, int fromIndex, int toIndex) Returns a new list containing a copy of the specified range of the original list.static <T> List<T> copyOfRange(List<T> c, int fromIndex, int toIndex, int step) Returns a new list containing a copy of the specified range of the original list, with elements selected at intervals defined by the step parameter.static <T> T[]copyOfRange(T[] original, int fromIndex, int toIndex) Returns a new Object array containing a copy of the specified range of the original array.static <T> T[]copyOfRange(T[] original, int fromIndex, int toIndex, int step) Returns a new Object array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static <T> T[]copyOfRange(T[] original, int fromIndex, int toIndex, int step, Class<? extends T[]> newType) Returns a new array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter.static <T,U> T[] copyOfRange(U[] original, int fromIndex, int toIndex, Class<? extends T[]> newType) Returns a new array containing a copy of the specified range of the original array.static <T> T[]copyThenReplaceAll(T[] a, UnaryOperator<T> operator) Creates a copy of the given array and replaces all elements in the copy using the providedUnaryOperator.static <T,E extends Exception>
T[]copyThenSetAll(T[] a, Throwables.IntObjFunction<? super T, ? extends T, E> converter) Creates a copy of the given array and sets all elements in the copy using the provided converter function.static <T> T[]copyThenSetAll(T[] a, IntFunction<? extends T> generator) Creates a copy of the given array and sets all elements in the copy using the provided generator function.static intcount(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter) Counts the number of elements within the specified range in the input boolean array that match the given predicate.static intcount(boolean[] a, BooleanPredicate filter) Counts the number of elements in the input boolean array that match the given predicate.static intcount(byte[] a, int fromIndex, int toIndex, BytePredicate filter) Counts the number of elements within the specified range in the input byte array that match the given predicate.static intcount(byte[] a, BytePredicate filter) Counts the number of elements in the input byte array that match the given predicate.static intcount(char[] a, int fromIndex, int toIndex, CharPredicate filter) Counts the number of elements within the specified range in the input byte array that match the given predicate.static intcount(char[] a, CharPredicate filter) Counts the number of elements in the input byte array that match the given predicate.static intcount(double[] a, int fromIndex, int toIndex, DoublePredicate filter) Counts the number of elements within the specified range in the input double array that match the given predicate.static intcount(double[] a, DoublePredicate filter) Counts the number of elements in the input double array that match the given predicate.static intcount(float[] a, int fromIndex, int toIndex, FloatPredicate filter) Counts the number of elements within the specified range in the input float array that match the given predicate.static intcount(float[] a, FloatPredicate filter) Counts the number of elements in the input float array that match the given predicate.static intcount(int[] a, int fromIndex, int toIndex, IntPredicate filter) Counts the number of elements within the specified range in the input int array that match the given predicate.static intcount(int[] a, IntPredicate filter) Counts the number of elements in the input int array that match the given predicate.static intcount(long[] a, int fromIndex, int toIndex, LongPredicate filter) Counts the number of elements within the specified range in the input long array that match the given predicate.static intcount(long[] a, LongPredicate filter) Counts the number of elements in the input long array that match the given predicate.static intcount(short[] a, int fromIndex, int toIndex, ShortPredicate filter) Counts the number of elements within the specified range in the input short array that match the given predicate.static intcount(short[] a, ShortPredicate filter) Counts the number of elements in the input short array that match the given predicate.static <T> intCounts the number of elements in the input iterable that match the given predicate.static <T> intcount(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter) Counts the number of elements within the specified range in the input collection that match the given predicate.static intCounts the number of elements in the input iterator.static <T> intCounts the number of elements in the input iterator that match the given predicate.static <T> intCounts the number of elements within the specified range in the input array that match the given predicate.static <T> intCounts the number of elements in the input array that match the given predicate.Counts the elements in the given iterable by the key extracted by the specifiedFunction<T, K>.countBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Counts the elements in the given iterable by the key extracted by the specifiedFunction<T, K>.Counts the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.countBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Counts the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.static booleandeepEquals(Object[] a, int fromIndexA, Object[] b, int fromIndexB, int len) Compares two arrays for deep equality within the specified range.static booleandeepEquals(Object[] a, Object[] b) Compares two arrays for deep equality.static booleandeepEquals(Object a, Object b) Compares two objects for equality.static intdeepHashCode(Object obj) Returns the hash code for the specified object.static intdeepHashCode(Object[] a) Returns the hash code for an array of Objects.static intdeepHashCode(Object[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in an Object array.static StringdeepToString(Object obj) Returns a string representation of the "deep contents" of the specified object.static StringdeepToString(Object[] a) Returns a string representation of the "deep contents" of the specified array.static StringdeepToString(Object[] a, int fromIndex, int toIndex) Returns a string representation of the "deep contents" of the specified range of elements in an Object array.static StringdeepToString(Object[] a, String defaultIfNull) Returns a string representation of the "deep contents" of the specified array.static <T extends CharSequence>
TdefaultIfBlank(T str, Supplier<? extends T> getterForDefaultStr) Returns the default value provided by specifiedSupplierif the specified object is blank or itself if the specified object is not blank.static <T extends CharSequence>
TdefaultIfBlank(T str, T defaultStr) Returns the specified default value if the specified object is blank or itself if the specified object is not blank.static <T extends CharSequence>
TdefaultIfEmpty(T str, Supplier<? extends T> getterForDefaultStr) Returns the default value provided by specifiedSupplierif the specified object is empty or itself if the specified object is not empty.static <T extends CharSequence>
TdefaultIfEmpty(T str, T defaultStr) Returns the specified default value if the specified object is empty or itself if the specified object is not empty.static booleanReturns the default value of the given type if the specified object isnullor itself if the specified object is notnull.static booleandefaultIfNull(Boolean b, boolean defaultForNull) Returns the specified default value if the specified object isnullor itself if the specified object is notnull.static byteReturns the default value of the given type if the specified object isnullor itself if the specified object is notnull.static bytedefaultIfNull(Byte b, byte defaultForNull) Returns the specified default value if the specified object isnullor itself if the specified object is notnull.static charReturns the default value of the given type if the specified object isnullor itself if the specified object is notnull.static chardefaultIfNull(Character c, char defaultForNull) Returns the specified default value if the specified object isnullor itself if the specified object is notnull.static doubleReturns the default value of the given type if the specified object isnullor itself if the specified object is notnull.static doubledefaultIfNull(Double b, double defaultForNull) Returns the specified default value if the specified object isnullor itself if the specified object is notnull.static floatReturns the default value of the given type if the specified object isnullor itself if the specified object is notnull.static floatdefaultIfNull(Float b, float defaultForNull) Returns the specified default value if the specified object isnullor itself if the specified object is notnull.static intReturns the default value of the given type if the specified object isnullor itself if the specified object is notnull.static intdefaultIfNull(Integer b, int defaultForNull) Returns the specified default value if the specified object isnullor itself if the specified object is notnull.static longReturns the default value of the given type if the specified object isnullor itself if the specified object is notnull.static longdefaultIfNull(Long b, long defaultForNull) Returns the specified default value if the specified object isnullor itself if the specified object is notnull.static shortReturns the default value of the given type if the specified object isnullor itself if the specified object is notnull.static shortdefaultIfNull(Short b, short defaultForNull) Returns the specified default value if the specified object isnullor itself if the specified object is notnull.static <T> TdefaultIfNull(T obj, Supplier<? extends T> supplierForDefault) Returns the default value provided by specifiedSupplierif the specified object isnullor itself if the specified object is notnull.static <T> TdefaultIfNull(T obj, T defaultForNull) Returns the specified default value if the given object isnull, otherwise returns the object itself.static <T> TdefaultValueOf(Class<T> cls) Returns the default value of the given class type.static boolean[]deleteAllByIndices(boolean[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static byte[]deleteAllByIndices(byte[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static char[]deleteAllByIndices(char[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static double[]deleteAllByIndices(double[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static float[]deleteAllByIndices(float[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static int[]deleteAllByIndices(int[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static long[]deleteAllByIndices(long[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static short[]deleteAllByIndices(short[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static String[]deleteAllByIndices(String[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static booleandeleteAllByIndices(List<?> list, int... indices) Deletes all elements at the specified positions from the given list.static <T> T[]deleteAllByIndices(T[] a, int... indices) Returns a new array with elements copied from the specified array except the elements at the specified positions.static boolean[]deleteByIndex(boolean[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static byte[]deleteByIndex(byte[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static char[]deleteByIndex(char[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static double[]deleteByIndex(double[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static float[]deleteByIndex(float[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static int[]deleteByIndex(int[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static long[]deleteByIndex(long[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static short[]deleteByIndex(short[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static <T> T[]deleteByIndex(T[] a, int index) Returns a new array with elements copied from the specified array except the element at the specified position.static boolean[]deleteRange(boolean[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static byte[]deleteRange(byte[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static char[]deleteRange(char[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static double[]deleteRange(double[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static float[]deleteRange(float[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static int[]deleteRange(int[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static long[]deleteRange(long[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static short[]deleteRange(short[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static String[]deleteRange(String[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static StringdeleteRange(String str, int fromIndex, int toIndex) Returns a new String with the specified range of chars removed
The original String remains unchanged.static <T> booleandeleteRange(List<T> c, int fromIndex, int toIndex) Deletes a range of elements from the given list.static <T> T[]deleteRange(T[] a, int fromIndex, int toIndex) Returns a new array with the specified range of elements removed
The original array remains unchanged.static boolean[]difference(boolean[] a, boolean[] b) Returns the elements in the specified boolean array a but not present in the boolean array b.static byte[]difference(byte[] a, byte[] b) Returns the elements in the specified byte array a but not present in the byte array b.static char[]difference(char[] a, char[] b) Returns the elements in the specified char array a but not present in the char array b.static double[]difference(double[] a, double[] b) Returns the elements in the specified double array a but not present in the double array b.static float[]difference(float[] a, float[] b) Returns the elements in the specified float array a but not present in the float array b.static int[]difference(int[] a, int[] b) Returns the elements in the specified int array a but not present in the int array b.static long[]difference(long[] a, long[] b) Returns the elements in the specified long array a but not present in the long array b.static short[]difference(short[] a, short[] b) Returns the elements in the specified short array a but not present in the short array b.static <T> List<T> difference(Collection<? extends T> a, Collection<?> b) Returns the elements in the specified collections a but not present in the specified collection b.static <T> List<T> difference(T[] a, Object[] b) Returns the elements in the specified arrays a but not present in the specified array b.static booleanChecks if the two specified arrays have no elements in common.static booleandisjoint(Collection<?> c1, Collection<?> c2) Checks if the two specified collections have no elements in common.static boolean[]distinct(boolean[] a) Returns a new array containing only the distinct elements from the specified array.static boolean[]distinct(boolean[] a, int fromIndex, int toIndex) Returns a new array containing only the distinct elements from the specified range in the input array.static byte[]distinct(byte[] a) Returns a new array containing only the distinct elements from the specified array.static byte[]distinct(byte[] a, int fromIndex, int toIndex) Returns a new array containing only the distinct elements from the specified range in the input array.static char[]distinct(char[] a) Returns a new array containing only the distinct elements from the specified array.static char[]distinct(char[] a, int fromIndex, int toIndex) Returns a new array containing only the distinct elements from the specified range in the input array.static double[]distinct(double[] a) Returns a new array containing only the distinct elements from the specified array.static double[]distinct(double[] a, int fromIndex, int toIndex) Returns a new array containing only the distinct elements from the specified range in the input array.static float[]distinct(float[] a) Returns a new array containing only the distinct elements from the specified array.static float[]distinct(float[] a, int fromIndex, int toIndex) Returns a new array containing only the distinct elements from the specified range in the input array.static int[]distinct(int[] a) Returns a new array containing only the distinct elements from the specified array.static int[]distinct(int[] a, int fromIndex, int toIndex) Returns a new array containing only the distinct elements from the specified range in the input array.static long[]distinct(long[] a) Returns a new array containing only the distinct elements from the specified array.static long[]distinct(long[] a, int fromIndex, int toIndex) Returns a new array containing only the distinct elements from the specified range in the input array.static short[]distinct(short[] a) Returns a new array containing only the distinct elements from the specified array.static short[]distinct(short[] a, int fromIndex, int toIndex) Returns a new array containing only the distinct elements from the specified range in the input array.static <T> List<T> Returns a new list containing only the distinct elements from the specified iterable.static <T> List<T> distinct(Collection<? extends T> c, int fromIndex, int toIndex) Returns a new list containing only the distinct elements from the specified range in the input collection.static <T> List<T> Returns a new list containing only the distinct elements from the specified iterator.static <T> List<T> distinct(T[] a) Returns a new list containing only the distinct elements from the specified array.static <T> List<T> distinct(T[] a, int fromIndex, int toIndex) Returns a new list containing only the distinct elements from the specified range in the input array.static <T> List<T> distinctBy(Iterable<? extends T> c, Function<? super T, ?> keyExtractor) Returns a new list containing only the distinct elements from the specified iterable, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.static <T,C extends Collection<T>>
CdistinctBy(Iterable<? extends T> c, Function<? super T, ?> keyExtractor, Supplier<C> supplier) Returns a new collection containing only the distinct elements from the specified iterable, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.static <T> List<T> distinctBy(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ?> keyExtractor) Returns a new list containing only the distinct elements from the specified range in the input collection, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.static <T> List<T> distinctBy(Iterator<? extends T> iter, Function<? super T, ?> keyExtractor) Returns a new list containing only the distinct elements from the specified iterator, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.static <T,C extends Collection<T>>
CdistinctBy(Iterator<? extends T> iter, Function<? super T, ?> keyExtractor, Supplier<C> supplier) Returns a new collection containing only the distinct elements from the specified iterator, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.static <T> List<T> distinctBy(T[] a, int fromIndex, int toIndex, Function<? super T, ?> keyExtractor) Returns a new list containing only the distinct elements from the specified range in the input array, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.static <T> List<T> distinctBy(T[] a, Function<? super T, ?> keyExtractor) Returns a new list containing only the distinct elements from the specified array, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.static <T,C extends Collection<T>>
CdistinctBy(T[] a, Function<? super T, ?> keyExtractor, Supplier<C> supplier) Returns a new collection containing only the distinct elements from the specified array, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.static <T> List<T> Returns a list containing the elements of the input iterable after dropping the elements that satisfy the provided predicate.static <T> List<T> Returns a list containing the elements of the input iterator after dropping the elements that satisfy the provided predicate.static <T> List<T> Returns a list containing the elements of the input array after dropping the elements that satisfy the provided predicate.static DataSetReturns an immutable/unmodifiable emptyDataSet.static InputStreamReturns an immutable/unmodifiable emptyInputStream.static <T> Iterator<T> Returns an immutable/unmodifiable empty iterator.static <T> List<T> Returns an immutable/unmodifiable emptyList.static <T> ListIterator<T> Returns an immutable/unmodifiable emptyListIterator.static <K,V> Map <K, V> emptyMap()Returns an immutable/unmodifiable emptyMap.static <K,V> NavigableMap <K, V> Returns an immutable/unmodifiable emptyNavigableMap.static <T> NavigableSet<T> Returns an immutable/unmodifiable emptyNavigableSet.static <T> Set<T> emptySet()Returns an immutable/unmodifiable emptySet.static <K,V> SortedMap <K, V> Returns an immutable/unmodifiable emptySortedMap.static <T> SortedSet<T> Returns an immutable/unmodifiable emptySortedSet.static <E extends Enum<E>>
ImmutableList<E> enumListOf(Class<E> enumClass) Returns an immutable/unmodifiable list of all the enum constants in the specified enum class.static <E extends Enum<E>>
ImmutableBiMap<E, String> Returns an immutable/unmodifiable bi-directional map of all the enum constants in the specified enum class to their names.static <E extends Enum<E>>
ImmutableSet<E> Returns an immutable/unmodifiable set of all the enum constants in the specified enum class.static booleanequals(boolean[] a, boolean[] b) Compares two arrays for equality.static booleanequals(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) Compares two boolean arrays for equality within the specified range.static booleanequals(boolean a, boolean b) Compares two boolean values for equality.static booleanequals(byte[] a, byte[] b) Compares two arrays for equality.static booleanequals(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) Compares two byte arrays for equality within the specified range.static booleanequals(byte a, byte b) Compares two byte values for equality.static booleanequals(char[] a, char[] b) Compares two arrays for equality.static booleanequals(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) Compares two char arrays for equality within the specified range.static booleanequals(char a, char b) Compares two char values for equality.static booleanequals(double[] a, double[] b) Compares two arrays for equality.static booleanequals(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) Compares two double arrays for equality within the specified range.static booleanequals(double a, double b) Compares two double values for equality.static booleanequals(float[] a, float[] b) Compares two arrays for equality.static booleanequals(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) Compares two float arrays for equality within the specified range.static booleanequals(float a, float b) Compares two float values for equality.static booleanequals(int[] a, int[] b) Compares two arrays for equality.static booleanequals(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) Compares two int arrays for equality within the specified range.static booleanequals(int a, int b) Compares two int values for equality.static booleanequals(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) Compares two long arrays for equality within the specified range.static booleanequals(long[] a, long[] b) Compares two arrays for equality.static booleanequals(long a, long b) Compares two long values for equality.static booleanequals(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) Compares two short arrays for equality within the specified range.static booleanequals(short[] a, short[] b) Compares two arrays for equality.static booleanequals(short a, short b) Compares two short values for equality.static booleanCompares two arrays for equality within the specified range.static booleanCompares two arrays for equality.static booleanCompares two objects for equality.static booleanCompares two strings for equality.static booleanequalsByCommonProps(Object bean1, Object bean2) Compares the properties of two beans to determine if they are equal.static booleanequalsByProps(Object bean1, Object bean2, Collection<String> propNamesToCompare) Compares the specified properties of two beans to determine if they are equal.static booleanequalsIgnoreCase(String[] a, int fromIndexA, String[] b, int fromIndexB, int len) Compares two arrays of Strings, ignoring case considerations, within the specified range.static booleanequalsIgnoreCase(String[] a, String[] b) Compares two arrays of Strings, ignoring case considerations.static booleanequalsIgnoreCase(String a, String b) Compares two strings for equality, ignoring case.static voidErases the properties of the given bean object.static voiderase(Object bean, Collection<String> propNames) Erases the properties of the given bean object.static voidErases all the properties of the given bean object.static <T> List<T> exclude(Collection<? extends T> c, Object objToExclude) Returns a newListcontaining all the elements from the specified collection except all occurrences of specified objToExclude.static <T> List<T> excludeAll(Collection<? extends T> c, Collection<?> objsToExclude) Returns a newListcontaining all the elements from the specified collection except all occurrences of elements in the specified objsToExclude.static <T> Set<T> excludeAllToSet(Collection<? extends T> c, Collection<?> objsToExclude) Returns a newSetcontaining all the elements from the specified collection except all occurrences of elements in the specified objsToExclude.static <T> Set<T> excludeToSet(Collection<? extends T> c, Object objToExclude) Returns a newSetcontaining all the elements from the specified collection except all occurrences of specified objToExclude.static voidexecute(Throwables.Runnable<? extends Exception> cmd, int retryTimes, long retryIntervallInMillis, Predicate<? super Exception> retryCondition) Executes the provided command with the specified retry logic in case of failure.static <R> Rexecute(Callable<R> cmd, int retryTimes, long retryIntervallInMillis, BiPredicate<? super R, ? super Exception> retryCondition) Executes the provided command with the specified retry logic in case of failure.static voidfill(boolean[] a, boolean val) Fills the specified boolean array with the specified value.static voidfill(boolean[] a, int fromIndex, int toIndex, boolean val) Fills the specified boolean array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidfill(byte[] a, byte val) Fills the specified byte array with the specified value.static voidfill(byte[] a, int fromIndex, int toIndex, byte val) Fills the specified byte array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidfill(char[] a, char val) Fills the specified char array with the specified value.static voidfill(char[] a, int fromIndex, int toIndex, char val) Fills the specified char array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidfill(double[] a, double val) Fills the specified double array with the specified value.static voidfill(double[] a, int fromIndex, int toIndex, double val) Fills the specified double array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidfill(float[] a, float val) Fills the specified float array with the specified value.static voidfill(float[] a, int fromIndex, int toIndex, float val) Fills the specified float array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidfill(int[] a, int val) Fills the specified int array with the specified value.static voidfill(int[] a, int fromIndex, int toIndex, int val) Fills the specified int array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidfill(long[] a, int fromIndex, int toIndex, long val) Fills the specified long array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidfill(long[] a, long val) Fills the specified long array with the specified value.static voidfill(short[] a, int fromIndex, int toIndex, short val) Fills the specified short array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidfill(short[] a, short val) Fills the specified short array with the specified value.static <T> TFills the properties of a new instance of the specified bean class with random values.static <T> List<T> Returns a list of new instances of the specified bean class with properties filled with random values.static voidFills the properties of the specified bean with random values.static voidFills the specified Object array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).static voidFills the specified Object array with the specified value.static <T> voidFills the specified list with the specified value from the specified start index to the specified end index.static <T> voidFills the specified list with the specified value.static boolean[]filter(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter) Returns a new array containing only the elements that match the filter predicate within the specified range in the input array.static boolean[]filter(boolean[] a, BooleanPredicate filter) Returns a new array containing only the elements that match the filter predicate.static byte[]filter(byte[] a, int fromIndex, int toIndex, BytePredicate filter) Returns a new array containing only the elements that match the filter predicate within the specified range in the input array.static byte[]filter(byte[] a, BytePredicate filter) Returns a new array containing only the elements that match the filter predicate.static char[]filter(char[] a, int fromIndex, int toIndex, CharPredicate filter) Returns a new array containing only the elements that match the filter predicate within the specified range in the input array.static char[]filter(char[] a, CharPredicate filter) Returns a new array containing only the elements that match the filter predicate.static double[]filter(double[] a, int fromIndex, int toIndex, DoublePredicate filter) Returns a new array containing only the elements that match the filter predicate within the specified range in the input array.static double[]filter(double[] a, DoublePredicate filter) Returns a new array containing only the elements that match the filter predicate.static float[]filter(float[] a, int fromIndex, int toIndex, FloatPredicate filter) Returns a new array containing only the elements that match the filter predicate within the specified range in the input array.static float[]filter(float[] a, FloatPredicate filter) Returns a new array containing only the elements that match the filter predicate.static int[]filter(int[] a, int fromIndex, int toIndex, IntPredicate filter) Returns a new array containing only the elements that match the filter predicate within the specified range in the input array.static int[]filter(int[] a, IntPredicate filter) Returns a new array containing only the elements that match the filter predicate.static long[]filter(long[] a, int fromIndex, int toIndex, LongPredicate filter) Returns a new array containing only the elements that match the filter predicate within the specified range in the input array.static long[]filter(long[] a, LongPredicate filter) Returns a new array containing only the elements that match the filter predicate.static short[]filter(short[] a, int fromIndex, int toIndex, ShortPredicate filter) Returns a new array containing only the elements that match the filter predicate within the specified range in the input array.static short[]filter(short[] a, ShortPredicate filter) Returns a new array containing only the elements that match the filter predicate.static <T> List<T> Returns a new list containing only the elements that match the filter predicate.static <T,C extends Collection<T>>
Cfilter(Iterable<? extends T> c, Predicate<? super T> filter, IntFunction<C> supplier) Returns a new collection containing only the elements that match the filter predicate.static <T> List<T> filter(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter) Returns a new list containing only the elements that match the filter predicate within the specified range in the input collection.static <T,C extends Collection<T>>
Cfilter(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter, IntFunction<C> supplier) Returns a new collection containing only the elements that match the filter predicate within the specified range in the input collection.static <T> List<T> Returns a new list containing only the elements that match the filter predicate.static <T,C extends Collection<T>>
Cfilter(Iterator<? extends T> iter, Predicate<? super T> filter, IntFunction<C> supplier) Returns a new collection containing only the elements that match the filter predicate.static <T> List<T> Returns a new list containing only the elements that match the filter predicate within the specified range in the input array.static <T,C extends Collection<T>>
Cfilter(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter, IntFunction<C> supplier) Returns a new collection containing only the elements that match the filter predicate within the specified range in the input array.static <T> List<T> Returns a new list containing only the elements that match the filter predicate.static <T,C extends Collection<T>>
Cfilter(T[] a, Predicate<? super T> filter, IntFunction<C> supplier) Returns a new collection containing only the elements that match the filter predicate.static <T,R> List <R> filterAndFlatMap(Iterable<? extends T> c, Predicate<? super T> filter, Function<? super T, ? extends Collection<? extends R>> mapper) Filters and flat-maps the elements in the given iterable.static <T,R, C extends Collection<R>>
CfilterAndFlatMap(Iterable<? extends T> c, Predicate<? super T> filter, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<C> supplier) Filters and flat-maps the elements in the given iterable.static <T,R> List <R> filterAndMap(Iterable<? extends T> c, Predicate<? super T> filter, Function<? super T, ? extends R> mapper) Filters and maps the elements in the given iterable.static <T,R, C extends Collection<R>>
CfilterAndMap(Iterable<? extends T> c, Predicate<? super T> filter, Function<? super T, ? extends R> mapper, IntFunction<C> supplier) Filters and maps the elements in the given iterable.static <T> u.Nullable<T> Returns the first element in the given iterable that matches the specified predicate.static <T> u.Nullable<T> Returns the first element in the given iterator that matches the specified predicate.static <T> u.Nullable<T> Returns the first element in the given array that matches the specified predicate.static <T> u.OptionalIntfindFirstIndex(Collection<? extends T> c, Predicate<? super T> predicate) Finds the index of the first element in the collection that matches the given predicate.static <T,U> u.OptionalInt findFirstIndex(Collection<? extends T> c, U u, BiPredicate<? super T, ? super U> predicate) Finds the index of the first element in the collection that matches the given predicate.static <T> u.OptionalIntfindFirstIndex(T[] a, Predicate<? super T> predicate) Finds the index of the first element in the array that matches the given predicate.static <T,U> u.OptionalInt findFirstIndex(T[] a, U u, BiPredicate<? super T, ? super U> predicate) Finds the index of the first element in the array that matches the given predicate.static <T> u.Optional<T> findFirstNonNull(Iterable<? extends T> c, Predicate<? super T> predicate) Returns the firstnon-nullelement in the given iterable that matches the specified predicate.static <T> u.Optional<T> findFirstNonNull(Iterator<? extends T> iter, Predicate<? super T> predicate) Returns the firstnon-nullelement in the given iterator that matches the specified predicate.static <T> u.Optional<T> findFirstNonNull(T[] a, Predicate<? super T> predicate) Returns the firstnon-nullelement in the given array that matches the specified predicate.static <T> u.Nullable<T> Returns the last element in the given iterable that matches the specified predicate.static <T> u.Nullable<T> Returns the last element in the given array that matches the specified predicate.static <T> u.OptionalIntfindLastIndex(Collection<? extends T> c, Predicate<? super T> predicate) Finds the index of the last element in the collection that matches the given predicate.static <T,U> u.OptionalInt findLastIndex(Collection<? extends T> c, U u, BiPredicate<? super T, ? super U> predicate) Finds the index of the last element in the collection that matches the given predicate.static <T> u.OptionalIntfindLastIndex(T[] a, Predicate<? super T> predicate) Finds the index of the last element in the array that matches the given predicate.static <T,U> u.OptionalInt findLastIndex(T[] a, U u, BiPredicate<? super T, ? super U> predicate) Finds the index of the last element in the array that matches the given predicate.static <T> u.Optional<T> findLastNonNull(Iterable<? extends T> c, Predicate<? super T> predicate) Returns the lastnon-nullelement in the given iterable that matches the specified predicate.static <T> u.Optional<T> findLastNonNull(T[] a, Predicate<? super T> predicate) Returns the lastnon-nullelement in the given array that matches the specified predicate.static <T> u.Nullable<T> firstElement(Iterable<? extends T> c) Returns the first element in the given Iterable wrapped in aNullable.static <T> u.Nullable<T> firstElement(Iterator<? extends T> iter) Returns the first element in the given Iterator wrapped in aNullable.static <T> List<T> firstElements(Iterable<? extends T> c, int n) Returns a list containing the first n elements from the given Iterable.static <T> List<T> firstElements(Iterator<? extends T> iter, int n) Returns a list containing the first n elements from the given Iterator.static <K,V> u.Optional <Map.Entry<K, V>> firstEntry(Map<K, V> map) Returns the first entry from the given map.static <T extends CharSequence>
u.Optional<T> firstNonBlank(T... a) Returns the first non-blank CharSequence from the given CharSequences.static <T extends CharSequence>
u.Optional<T> firstNonBlank(T a, T b) Returns the first non-blank CharSequence from the given CharSequences.static <T extends CharSequence>
u.Optional<T> firstNonBlank(T a, T b, T c) Returns the first non-blank CharSequence from the given CharSequences.static <T extends CharSequence>
u.Optional<T> firstNonEmpty(T... a) Returns the first non-empty CharSequence from the given CharSequences.static <T> u.Optional<T[]> firstNonEmpty(T[] a, T[] b) Returns the first non-empty array from the given arrays.static <T> u.Optional<T[]> firstNonEmpty(T[] a, T[] b, T[] c) Returns the first non-empty array from the given arrays.static <T extends Collection<?>>
u.Optional<T> firstNonEmpty(T a, T b) Returns the first non-empty collection from the given collections.static <T extends Collection<?>>
u.Optional<T> firstNonEmpty(T a, T b, T c) Returns the first non-empty collection from the given collections.static <T> u.Optional<T> firstNonNull(Iterable<? extends T> c) Returns the firstnon-nullvalue from the provided iterable.static <T> u.Optional<T> firstNonNull(Iterator<? extends T> iter) Returns the firstnon-nullvalue from the provided iterator.static <T> u.Optional<T> firstNonNull(T... a) Returns the firstnon-nullvalue among the provided values.static <T> u.Optional<T> firstNonNull(T a, T b) Returns the firstnon-nullvalue among the two provided values.static <T> u.Optional<T> firstNonNull(T a, T b, T c) Returns the firstnon-nullvalue among the three provided values.static <T> TfirstOrDefaultIfEmpty(Iterable<? extends T> c, T defaultValueForEmpty) Returns the first element of the given iterable if it is not empty, otherwise returns the specified default value.static <T> TfirstOrDefaultIfEmpty(Iterator<? extends T> iter, T defaultValueForEmpty) Returns the first element of the given iterator if it is not empty, otherwise returns the specified default value.static <T> TfirstOrDefaultIfEmpty(T[] a, T defaultValueForEmpty) Returns the first element of the given array if it is not empty, otherwise returns the specified default value.static <T> TfirstOrNullIfEmpty(Iterable<? extends T> c) Returns the first element of the given iterable if it is not empty, otherwise returnsnull.static <T> TfirstOrNullIfEmpty(Iterator<? extends T> iter) Returns the first element of the given iterator if it is not empty, otherwise returnsnull.static <T> TfirstOrNullIfEmpty(T[] a) Returns the first element of the given array if it is not empty, otherwise returnsnull.static <T,R> List <R> flatMap(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements in the specified iterable from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,R, C extends Collection<R>>
CflatMap(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified iterable from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,U, R> List <R> flatMap(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) Transforms the elements in the specified iterable from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.static <T,U, R, C extends Collection<R>>
CflatMap(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Transforms the elements in the specified iterable from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.static <T,R> List <R> flatMap(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements within the specified range in the input collection from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,R, C extends Collection<R>>
CflatMap(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) Transforms the elements within the specified range in the input collection from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,R> List <R> flatMap(Iterator<? extends T> iter, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements in the specified iterator from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,R, C extends Collection<R>>
CflatMap(Iterator<? extends T> iter, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified iterator from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,U, R> List <R> flatMap(Iterator<? extends T> iter, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) Transforms the elements in the specified iterator from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.static <T,U, R, C extends Collection<R>>
CflatMap(Iterator<? extends T> iter, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Transforms the elements in the specified iterator from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.static <T,R> List <R> flatMap(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements within the specified range in the input array from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,R, C extends Collection<R>>
CflatMap(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) Transforms the elements within the specified range in the input array from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,R> List <R> flatMap(T[] a, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements in the specified array from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,R, C extends Collection<R>>
CflatMap(T[] a, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified array from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.static <T,U, R> List <R> flatMap(T[] a, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) Transforms the elements in the specified array from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.static <T,U, R, C extends Collection<R>>
CflatMap(T[] a, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Transforms the elements in the specified array from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.static <T,R> List <R> flatMapAndFilter(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper, Predicate<? super R> filter) Flat-maps and filters the elements in the given iterable.static <T,R, C extends Collection<R>>
CflatMapAndFilter(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper, Predicate<? super R> filter, IntFunction<? extends C> supplier) Flat-maps and filters the elements in the given iterable.static boolean[]flatten(boolean[][] a) Flattens a two-dimensional boolean array into a one-dimensional boolean array.static byte[]flatten(byte[][] a) Flattens a two-dimensional byte array into a one-dimensional byte array.static char[]flatten(char[][] a) Flattens a two-dimensional char array into a one-dimensional char array.static double[]flatten(double[][] a) Flattens a two-dimensional double array into a one-dimensional double array.static float[]flatten(float[][] a) Flattens a two-dimensional float array into a one-dimensional float array.static int[]flatten(int[][] a) Flattens a two-dimensional int array into a one-dimensional int array.static long[]flatten(long[][] a) Flattens a two-dimensional long array into a one-dimensional long array.static short[]flatten(short[][] a) Flattens a two-dimensional short array into a one-dimensional short array.static <T> List<T> Flattens anIterableofIterable<T>into a one-dimensional List.static <T,C extends Collection<T>>
Cflatten(Iterable<? extends Iterable<? extends T>> c, IntFunction<? extends C> supplier) Flattens anIterableofIterable<T>into a one-dimensional Collection.static <T> ObjIterator<T> Flattens anIteratorofIterator<T>into a one-dimensional Iterator.static <T> T[]flatten(T[][] a) Flattens a two-dimensional array into a one-dimensional array.static <T> T[]Flattens a two-dimensional array into a one-dimensional array.static List<?> flattenEachElement(Iterable<?> c) Flattens each element of the providedIterableif it's anIterableitself, otherwise just adds it to the result List.static <T,C extends Collection<T>>
CflattenEachElement(Iterable<?> c, Supplier<? extends C> supplier) Flattens each element of the providedIterableif it's anIterableitself, otherwise just adds it to the result Collection.static <E extends Exception>
voidforEach(int startInclusive, int endExclusive, int step, Throwables.IntConsumer<E> action) Executes the providedactionfor each value in the range defined bystartInclusive,endExclusiveandstep.static <E extends Exception>
voidforEach(int startInclusive, int endExclusive, int step, Throwables.Runnable<E> action) Executes the providedactionfor each value in the range defined bystartInclusive,endExclusiveandstep.static <T,E extends Exception>
voidforEach(int startInclusive, int endExclusive, int step, T a, Throwables.IntObjConsumer<? super T, E> action) Executes the providedactionfor each value in the range defined bystartInclusive,endExclusiveandstep, passing the current index and the provided objectato the action.static <E extends Exception>
voidforEach(int startInclusive, int endExclusive, Throwables.IntConsumer<E> action) Executes the providedactionfor each value in the range defined bystartInclusiveandendExclusive.static <E extends Exception>
voidforEach(int startInclusive, int endExclusive, Throwables.Runnable<E> action) Executes the providedactionfor each value in the range defined bystartInclusiveandendExclusive.static <T,E extends Exception>
voidforEach(int startInclusive, int endExclusive, T a, Throwables.IntObjConsumer<? super T, E> action) Executes the providedactionfor each value in the range defined bystartInclusiveandendExclusive, passing the current index and the provided objectato the action.static <A,B, E extends Exception>
voidforEach(A[] a, B[] b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, E> action) Executes the providedactionfor each pair of elements from the given arrays until all elements from the longer array are processed.static <A,B, C, E extends Exception>
voidforEach(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) Executes the providedactionfor each triple of elements from the given arrays until all elements from the longest array are processed.static <A,B, C, E extends Exception>
voidforEach(A[] a, B[] b, C[] c, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) Executes the providedactionfor each triple of elements from the given arrays until all elements from the shortest array are processed.static <A,B, E extends Exception>
voidforEach(A[] a, B[] b, Throwables.BiConsumer<? super A, ? super B, E> action) Executes the providedactionfor each pair of elements from the given arrays until all elements from the shorter array are processed.static <T,E extends Exception>
voidforEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> action) Executes the providedactionfor each element in the given iterable.static <T,E extends Exception>
voidforEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum) Executes the providedelementConsumerfor each element in the given iterable by the specified number of threads.static <T,E extends Exception>
voidforEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) Executes the providedelementConsumerfor each element in the given iterable by the specified number of threads and executor.forEach(Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor each element in the given iterable after applying theflatMapperandflatMapper2functions.forEach(Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to each element in the given iterable, and then executes the specifiedactionto each resulting element.static <A,B, E extends Exception>
voidforEach(Iterable<A> a, Iterable<B> b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, E> action) Executes the providedactionfor each pair of elements from the given iterables until all elements from the longer iterable are processed.static <A,B, E extends Exception>
voidforEach(Iterable<A> a, Iterable<B> b, Throwables.BiConsumer<? super A, ? super B, E> action) Executes the providedactionfor each pair of elements from the given iterables until all elements from the shorter iterable are processed.static <A,B, C, E extends Exception>
voidforEach(Iterable<A> a, Iterable<B> b, Iterable<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) Executes the providedactionfor each triple of elements from the given iterables until all elements from the longest iterable are processed.static <A,B, C, E extends Exception>
voidforEach(Iterable<A> a, Iterable<B> b, Iterable<C> c, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) Executes the providedactionfor each triple of elements from the given iterables until all elements from the shortest iterable are processed.static <T,E extends Exception>
voidforEach(Collection<? extends T> c, int fromIndex, int toIndex, Throwables.Consumer<? super T, E> action) Executes the providedactionfor each element within the specified range in the given collection.static <T,E extends Exception>
voidforEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> action) Executes the providedactionfor each element in the given iterator.static <T,E extends Exception>
voidforEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum) Executes the providedelementConsumerfor each element in the given iterator by the specified number of threads.static <T,E extends Exception>
voidforEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) Executes the providedelementConsumerfor each element in the given iterator by the specified number of threads and executor.forEach(Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor each element in the given iterator after applying theflatMapperandflatMapper2functions.forEach(Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to each element in the given iterator, and then executes the specifiedactionto each resulting element.static <A,B, E extends Exception>
voidforEach(Iterator<A> a, Iterator<B> b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, E> action) Executes the providedactionfor each pair of elements from the given iterators until all elements from the longer iterator are processed.static <A,B, E extends Exception>
voidforEach(Iterator<A> a, Iterator<B> b, Throwables.BiConsumer<? super A, ? super B, E> action) Executes the providedactionfor each pair of elements from the given iterators until all elements from the shorter iterator are processed.static <A,B, C, E extends Exception>
voidforEach(Iterator<A> a, Iterator<B> b, Iterator<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) Executes the providedactionfor each triple of elements from the given iterators until all elements from the longest iterator are processed.static <A,B, C, E extends Exception>
voidforEach(Iterator<A> a, Iterator<B> b, Iterator<C> c, Throwables.TriConsumer<? super A, ? super B, ? super C, E> action) Executes the providedactionfor each triple of elements from the given iterators until all elements from the shortest iterator are processed.static <K,V, E extends Exception>
voidforEach(Map<K, V> map, Throwables.BiConsumer<? super K, ? super V, E> action) Executes the providedactionfor each entry in the given map.static <K,V, E extends Exception>
voidforEach(Map<K, V> map, Throwables.Consumer<? super Map.Entry<K, V>, E> action) Executes the providedactionfor each entry in the given map.static <T,E extends Exception>
voidforEach(T[] a, int fromIndex, int toIndex, Throwables.Consumer<? super T, E> action) Executes the providedactionfor each element within the specified range in the given array.static <T,E extends Exception>
voidforEach(T[] a, Throwables.Consumer<? super T, E> action) Executes the providedactionfor each element in the given array.forEach(T[] a, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor each element in the given array after applying theflatMapperandflatMapper2functions.forEach(T[] a, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to each element in the given array, and then executes the specifiedactionto each resulting element.static <T,E extends Exception>
voidforEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> action) Executes the providedactionfor each element in the given iterable, passing the index and the element to the action.static <T,E extends Exception>
voidforEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> action, int processThreadNum) Executes the providedactionfor each element in the givenIterable, passing the index and the element to the action, by the specified number of threads.static <T,E extends Exception>
voidforEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> action, int processThreadNum, Executor executor) Executes the providedactionfor each element in the givenIterable, passing the index and the element to the action, by the specified number of threads and executor.static <T,E extends Exception>
voidforEachIndexed(Collection<? extends T> c, int fromIndex, int toIndex, Throwables.IntObjConsumer<? super T, E> action) Executes the providedactionfor each element within the specified range in the given collection, passing the index and the element to the action.static <T,E extends Exception>
voidforEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> action) Executes the providedactionfor each element in the given iterable, passing the index and the element to the action.static <T,E extends Exception>
voidforEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum) Executes the providedactionfor each element in the givenIterator, passing the index and the element to the action, by the specified number of threads.static <T,E extends Exception>
voidforEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) Executes the providedactionfor each element in the givenIterator, passing the index and the element to the action, by the specified number of threads and executor.static <K,V, E extends Exception>
voidforEachIndexed(Map<K, V> map, Throwables.IntBiObjConsumer<? super K, ? super V, E> action) Executes the providedactionfor each entry in the given map, passing the index, the key, and the value to the action.static <K,V, E extends Exception>
voidforEachIndexed(Map<K, V> map, Throwables.IntObjConsumer<? super Map.Entry<K, V>, E> action) Executes the providedactionfor each entry in the given map, passing the index and the entry to the action.static <T,E extends Exception>
voidforEachIndexed(T[] a, int fromIndex, int toIndex, Throwables.IntObjConsumer<? super T, E> action) Executes the providedactionfor each element within the specified range in the given array, passing the index and the element to the action.static <T,E extends Exception>
voidforEachIndexed(T[] a, Throwables.IntObjConsumer<? super T, E> action) Executes the providedactionfor each element in the given array, passing the index and the element to the action.static <T,E extends Exception>
voidforEachNonNull(Iterable<? extends T> c, Throwables.Consumer<? super T, E> action) Executes the providedactionfor eachnon-nullelement in the given iterable.forEachNonNull(Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor eachnon-nullelement in the given iterable after applying theflatMapperandflatMapper2functions.forEachNonNull(Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to eachnon-nullelement in the given iterable, and then executes the specifiedactionto eachnon-nullresulting element.static <T,E extends Exception>
voidforEachNonNull(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> action) Executes the providedactionfor eachnon-nullelement in the given iterator.forEachNonNull(Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor eachnon-nullelement in the given iterator after applying theflatMapperandflatMapper2functions.forEachNonNull(Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to eachnon-nullelement in the given iterator, and then executes the specifiedactionto eachnon-nullresulting element.static <T,E extends Exception>
voidforEachNonNull(T[] a, Throwables.Consumer<? super T, E> action) Executes the providedactionfor eachnon-nullelement in the given array.forEachNonNull(T[] a, Throwables.Function<? super T, ? extends Iterable<T2>, E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor eachnon-nullelement in the given array after applying theflatMapperandflatMapper2functions.forEachNonNull(T[] a, Throwables.Function<? super T, ? extends Iterable<U>, E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to eachnon-nullelement in the given array, and then executes the specifiedactionto eachnon-nullresulting element.static <T,E extends Exception>
voidforEachPair(Iterable<? extends T> c, int increment, Throwables.BiConsumer<? super T, ? super T, E> action) Executes the providedactionfor each pair of consecutive elements in the given iterable, with the specified increment between pairs.static <T,E extends Exception>
voidforEachPair(Iterable<? extends T> c, Throwables.BiConsumer<? super T, ? super T, E> action) Executes the providedactionfor each pair of consecutive elements in the given iterable.static <T,E extends Exception>
voidforEachPair(Iterator<? extends T> iter, int increment, Throwables.BiConsumer<? super T, ? super T, E> action) Executes the providedactionfor each pair of consecutive elements in the given iterator, with the specified increment between pairs.static <T,E extends Exception>
voidforEachPair(Iterator<? extends T> iter, Throwables.BiConsumer<? super T, ? super T, E> action) Executes the providedactionfor each pair of consecutive elements in the given iterator.static <T,E extends Exception>
voidforEachPair(T[] a, int increment, Throwables.BiConsumer<? super T, ? super T, E> action) Executes the providedactionfor each pair of consecutive elements in the given array, with the specified increment between pairs.static <T,E extends Exception>
voidforEachPair(T[] a, Throwables.BiConsumer<? super T, ? super T, E> action) Executes the providedactionfor each pair of consecutive elements in the given array.static <T,E extends Exception>
voidforEachTriple(Iterable<? extends T> c, int increment, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given iterable, with the specified increment between triples.static <T,E extends Exception>
voidforEachTriple(Iterable<? extends T> c, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given iterable.static <T,E extends Exception>
voidforEachTriple(Iterator<? extends T> iter, int increment, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given iterator, with the specified increment between triples.static <T,E extends Exception>
voidforEachTriple(Iterator<? extends T> iter, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given iterator.static <T,E extends Exception>
voidforEachTriple(T[] a, int increment, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given array, with the specified increment between triples.static <T,E extends Exception>
voidforEachTriple(T[] a, Throwables.TriConsumer<? super T, ? super T, ? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given array.static StringformatJson(String json) Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.static StringformatJson(String json, JSONSerializationConfig config) Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.static StringformatJson(String json, JSONSerializationConfig config, com.landawn.abacus.type.Type<?> transferType) Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.static StringformatJson(String json, JSONSerializationConfig config, Class<?> transferType) Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.static StringformatJson(String json, com.landawn.abacus.type.Type<?> transferType) Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.static StringformatJson(String json, Class<?> transferType) Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.static StringFormats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading.static StringformatXml(String xml, XMLSerializationConfig config) Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading with the specifiedXMLSerializationConfig.static StringformatXml(String xml, XMLSerializationConfig config, com.landawn.abacus.type.Type<?> transferType) Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading with the specifiedXMLSerializationConfigstatic StringformatXml(String xml, XMLSerializationConfig config, Class<?> transferType) Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading with the specifiedXMLSerializationConfigstatic StringFormats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading.static StringFormats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading.static voidPrints the formatted string to the standard output using the specified format and arguments.static <T> TfromJson(File json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string from the specified file into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TfromJson(File json, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON string from the specified file into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TDeserializes the given JSON string from the specified file into an object of the specified target type.static <T> TDeserializes the given JSON string from the specified file into an object of the specified target type.static <T> TfromJson(InputStream json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string from the specified input stream into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TfromJson(InputStream json, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON string from the specified input stream into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TfromJson(InputStream json, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string from the specified input stream into an object of the specified target type.static <T> TfromJson(InputStream json, Class<? extends T> targetType) Deserializes the given JSON string from the specified input stream into an object of the specified target type.static <T> TfromJson(Reader json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string from the specified reader into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TfromJson(Reader json, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON string from the specified reader into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TDeserializes the given JSON string from the specified reader into an object of the specified target type.static <T> TDeserializes the given JSON string from the specified reader into an object of the specified target type.static <T> TfromJson(String json, int fromIndex, int toIndex, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON sub-string in the specified range into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TfromJson(String json, int fromIndex, int toIndex, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON sub-string in the specified range into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TfromJson(String json, int fromIndex, int toIndex, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON sub-string in the specified range into an object of the specified target type.static <T> TDeserializes the given JSON sub-string in the specified range into an object of the specified target type.static <T> TfromJson(String json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TfromJson(String json, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON string into an object of the specified target type with the specifiedJSONDeserializationConfig.static <T> TDeserializes the given JSON string into an object of the specified target type.static <T> TDeserializes the given JSON string into an object of the specified target type.static <T> TDeserializes the given JSON string into an object of the specified target type.static <T> TDeserializes the given JSON string into an object of the specified target type.static <T> TfromXml(File xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string from the specified file into an object of the specified target type with the specifiedXMLDeserializationConfig.static <T> TfromXml(File xml, XMLDeserializationConfig config, Class<? extends T> targetType) Deserializes the given XML string from the specified file into an object of the specified target type with the specifiedXMLDeserializationConfig.static <T> TDeserializes the given XML string from the specified file into an object of the specified target type.static <T> TDeserializes the given XML string from the specified file into an object of the specified target type.static <T> TfromXml(InputStream xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string from the specified input stream into an object of the specified target type with the specifiedXMLDeserializationConfig.static <T> TfromXml(InputStream xml, XMLDeserializationConfig config, Class<? extends T> targetType) Deserializes the given XML string from the specified input stream into an object of the specified target type with the specifiedXMLDeserializationConfig.static <T> TfromXml(InputStream xml, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string from the specified input stream into an object of the specified target type.static <T> TfromXml(InputStream xml, Class<? extends T> targetType) Deserializes the given XML string from the specified input stream into an object of the specified target type.static <T> TfromXml(Reader xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string from the specified reader into an object of the specified target type with the specifiedXMLDeserializationConfig.static <T> TfromXml(Reader xml, XMLDeserializationConfig config, Class<? extends T> targetType) Deserializes the given XML string from the specified reader into an object of the specified target type with the specifiedXMLDeserializationConfig.static <T> TDeserializes the given XML string from the specified reader into an object of the specified target type.static <T> TDeserializes the given XML string from the specified reader into an object of the specified target type.static <T> TfromXml(String xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string into an object of the specified target type with the specifiedXMLDeserializationConfig.static <T> TfromXml(String xml, XMLDeserializationConfig config, Class<? extends T> targetType) Deserializes the given XML string into an object of the specified target type with the specifiedXMLDeserializationConfig.static <T> TDeserializes the given XML string into an object of the specified target type.static <T> TDeserializes the given XML string into an object of the specified target type.static <T extends Comparable<? super T>>
booleangeAndLe(T value, T min, T max) Checks if the given value is greater than or equal to the minimum value and less than or equal to the maximum value.static <T> booleangeAndLe(T value, T min, T max, Comparator<? super T> cmp) Checks if the given value is greater than or equal to the minimum value and less than or equal to the maximum value using the specified comparator.static <T extends Comparable<? super T>>
booleangeAndLt(T value, T min, T max) Checks if the given value is greater than or equal to the minimum value and less than the maximum value.static <T> booleangeAndLt(T value, T min, T max, Comparator<? super T> cmp) Checks if the given value is greater than or equal to the minimum value and less than the maximum value using the specified comparator.static <T> TgetElement(Iterable<? extends T> c, int index) Retrieves the element at the specified position in the given Iterable.static <T> TgetElement(Iterator<? extends T> iter, long index) Retrieves the element at the specified position in the given Iterator.static <T> u.Nullable<T> getOnlyElement(Iterable<? extends T> c) Returns the only element in the given Iterable.static <T> u.Nullable<T> getOnlyElement(Iterator<? extends T> iter) Returns the only element in the given Iterator.static ImmutableList<String> getPropNames(Class<?> beanClass) Retrieves the property names of the given bean class.getPropNames(Class<?> beanClass, Set<String> propNameToExclude) Retrieves the property names of the given bean class excluding the specified property names.getPropNames(Object bean) Retrieves the property names of the given bean object.getPropNames(Object bean, boolean ignoreNullValue) Retrieves the property names of the given bean object.static <T> TgetPropValue(Object bean, String propName) Retrieves the value of the specified property from the given bean object.static <T> TgetPropValue(Object bean, String propName, boolean ignoreUnmatchedProperty) Retrieves the value of the specified property from the given bean object.static <T extends Comparable<? super T>>
booleangreaterEqual(T a, T b) Compares two comparable objects to determine if the first is greater than or equal to the second.static <T> booleangreaterEqual(T a, T b, Comparator<? super T> cmp) Compares two objects using the specified comparator to determine if the first is greater than or equal to the second.static <T extends Comparable<? super T>>
booleangreaterThan(T a, T b) Compares two comparable objects to determine if the first is greater than the second.static <T> booleangreaterThan(T a, T b, Comparator<? super T> cmp) Compares two objects using the specified comparator to determine if the first is greater than the second.Groups the elements in the given iterable by the key extracted by the specifiedFunction<T, K>.groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) Groups the elements in the given iterable by the key extracted by the specifiedFunction<T, K>.groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<M> mapSupplier) Groups the elements in the given iterable by the key extracted by the specifiedFunction<T, K>.groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Groups the elements in the given iterable by the key extracted by the specifiedFunction<T, K>.static <T,K, R> Map <K, R> groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector) Groups the elements in the given array by the key extracted by the specifiedFunction<T, K>.static <T,K, R, M extends Map<K, R>>
MgroupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector, Supplier<M> mapSupplier) Groups the elements in the given array by the key extracted by the specifiedFunction<T, K>.groupBy(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor) Groups the elements within specified range in the given collection by the key extracted by the specifiedFunction<T, K>.groupBy(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Groups the elements within specified range in the given collection by the key extracted by the specifiedFunction<T, K>.Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<M> mapSupplier) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.static <K,T, R> Map <K, R> groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.static <K,T, R, M extends Map<K, R>>
MgroupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector, Supplier<M> mapSupplier) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.Groups the elements within specified range in the given array by the key extracted by the specifiedFunction<T, K>.groupBy(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Groups the elements within specified range in the given array by the key extracted by the specifiedFunction<T, K>.Groups the elements in the given array by the key extracted by the specifiedFunction<T, K>.Groups the elements in the given array by the key extracted by the specifiedFunction<T, K>.static <T extends Comparable<? super T>>
booleangtAndLe(T value, T min, T max) Checks if the given value is greater than the minimum value and less than or equal to the maximum value.static <T> booleangtAndLe(T value, T min, T max, Comparator<? super T> cmp) Checks if the given value is greater than the minimum value and less than or equal to the maximum value using the specified comparator.static <T extends Comparable<? super T>>
booleangtAndLt(T value, T min, T max) Checks if the given value is greater than the minimum value and less than the maximum value.static <T> booleangtAndLt(T value, T min, T max, Comparator<? super T> cmp) Checks if the given value is greater than the minimum value and less than the maximum value using the specified comparator.static booleanhasDuplicates(boolean[] a) Checks if the given array has duplicate elements.static booleanhasDuplicates(byte[] a) Checks if the given array has duplicate elements.static booleanhasDuplicates(byte[] a, boolean isSorted) Checks if the given array has duplicate elements.static booleanhasDuplicates(char[] a) Checks if the given array has duplicate elements.static booleanhasDuplicates(char[] a, boolean isSorted) Checks if the given array has duplicate elements.static booleanhasDuplicates(double[] a) Checks if the given array has duplicate elements.static booleanhasDuplicates(double[] a, boolean isSorted) Checks if the given array has duplicate elements.static booleanhasDuplicates(float[] a) Checks if the given array has duplicate elements.static booleanhasDuplicates(float[] a, boolean isSorted) Checks if the given array has duplicate elements.static booleanhasDuplicates(int[] a) Checks if the given array has duplicate elements.static booleanhasDuplicates(int[] a, boolean isSorted) Checks if the given array has duplicate elements.static booleanhasDuplicates(long[] a) Checks if the given array has duplicate elements.static booleanhasDuplicates(long[] a, boolean isSorted) Checks if the given array has duplicate elements.static booleanhasDuplicates(short[] a) Checks if the given array has duplicate elements.static booleanhasDuplicates(short[] a, boolean isSorted) Checks if the given array has duplicate elements.static booleanhasDuplicates(Collection<?> c) Checks if the given collection has duplicate elements.static booleanhasDuplicates(Collection<?> c, boolean isSorted) Checks if the given collection has duplicate elements.static <T> booleanhasDuplicates(T[] a) Checks if the given array has duplicate elements.static <T> booleanhasDuplicates(T[] a, boolean isSorted) Checks if the given array has duplicate elements.static inthashCode(boolean value) Returns the hash code for a boolean value.static inthashCode(boolean[] a) Returns the hash code for an array of booleans.static inthashCode(boolean[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in a boolean array.static inthashCode(byte value) Returns the hash code for a byte value.static inthashCode(byte[] a) Returns the hash code for an array of bytes.static inthashCode(byte[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in a byte array.static inthashCode(char value) Returns the hash code for a char value.static inthashCode(char[] a) Returns the hash code for an array of chars.static inthashCode(char[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in a char array.static inthashCode(double value) Returns the hash code for a double value.static inthashCode(double[] a) Returns the hash code for an array of doubles.static inthashCode(double[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in a double array.static inthashCode(float value) Returns the hash code for a float value.static inthashCode(float[] a) Returns the hash code for an array of floats.static inthashCode(float[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in a float array.static inthashCode(int value) Returns the hash code for an int value.static inthashCode(int[] a) Returns the hash code for an array of ints.static inthashCode(int[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in an int array.static inthashCode(long value) Returns the hash code for a long value.static inthashCode(long[] a) Returns the hash code for an array of longs.static inthashCode(long[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in a long array.static inthashCode(short value) Returns the hash code for a short value.static inthashCode(short[] a) Returns the hash code for an array of shorts.static inthashCode(short[] a, int fromIndex, int toIndex) Returns the hash code for a range of elements in a short array.static intReturns the hash code for an object.static intReturns the hash code for an array of Objects.static intReturns the hash code for a range of elements in an Object array.static <C extends Collection,E extends Exception>
voidifNotEmpty(C c, Throwables.Consumer<? super C, E> cmd) Executes the provided action if the given collection is not empty.static <CS extends CharSequence,E extends Exception>
voidifNotEmpty(CS c, Throwables.Consumer<? super CS, E> cmd) Executes the provided action if the givenCharSequenceis not empty.ifNotEmpty(M m, Throwables.Consumer<? super M, E> cmd) Executes the provided action if the given map is not empty.static <T,E extends Exception>
voidifNotNull(T obj, Throwables.Consumer<? super T, E> cmd) Executes the givenConsumerif the provided object is notnull.ifOrElse(boolean b, Throwables.Runnable<E1> actionForTrue, Throwables.Runnable<E2> actionForFalse) Deprecated.it's not a good idea? if-else is better?static <R,E extends Exception>
u.Nullable<R> ifOrEmpty(boolean b, Throwables.Supplier<R, E> supplier) Returns aNullablecontaining the result of the given supplier if the condition istrue.static intindexOf(boolean[] a, boolean valueToFind) Returns the index of the first occurrence of the specified value in the array.static intindexOf(boolean[] a, boolean valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intindexOf(byte[] a, byte valueToFind) Returns the index of the first occurrence of the specified value in the array.static intindexOf(byte[] a, byte valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intindexOf(char[] a, char valueToFind) Returns the index of the first occurrence of the specified value in the array.static intindexOf(char[] a, char valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intindexOf(double[] a, double valueToFind) Returns the index of the first occurrence of the specified value in the array.static intindexOf(double[] a, double valueToFind, double tolerance) Finds the index of the given value within a given tolerance in the array.static intindexOf(double[] a, double valueToFind, double tolerance, int fromIndex) Finds the index of the given value in the array starting at the given index.static intindexOf(double[] a, double valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intindexOf(float[] a, float valueToFind) Returns the index of the first occurrence of the specified value in the array.static intindexOf(float[] a, float valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intindexOf(int[] a, int valueToFind) Returns the index of the first occurrence of the specified value in the array.static intindexOf(int[] a, int valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intindexOf(long[] a, long valueToFind) Returns the index of the first occurrence of the specified value in the array.static intindexOf(long[] a, long valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intindexOf(short[] a, short valueToFind) Returns the index of the first occurrence of the specified value in the array.static intindexOf(short[] a, short valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intReturns the index of the first occurrence of the specified value in the array.static intReturns the index of the first occurrence of the specified value in the array, starting the search at the specified index.static intindexOf(Collection<?> c, Object valueToFind) Returns the index of the first occurrence of the specified value in the specified collection.static intindexOf(Collection<?> c, Object valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the specified collection, starting the search at the specified index.static intReturns the index of the first occurrence of the specified value in the given iterator.static intReturns the index of the first occurrence of the specified value in the given iterator, starting the search from the specified index.static intindexOfIgnoreCase(String[] a, String valueToFind) Returns the index of the first occurrence of the specified string in the array, ignoring case considerations.static intindexOfIgnoreCase(String[] a, String valueToFind, int fromIndex) Returns the index of the first occurrence of the specified string in the array, ignoring case considerations, starting the search at the specified index.static intindexOfSubList(List<?> sourceList, List<?> subListToFind) Returns the starting position of the first occurrence of the specified sublist within the source list.static intindexOfSubList(List<?> sourceList, List<?> subListToFind, int fromIndex) Returns the starting position of the first occurrence of the specified sublist within the source list, starting the search at the specified index.static int[]indicesOfAll(Object[] a, Object valueToFind) Returns the indices of all occurrences of the specified value in the given array.static int[]indicesOfAll(Object[] a, Object valueToFind, int startIndex) Returns the indices of all occurrences of the specified value in the given array, starting the search from the specified index.static int[]indicesOfAll(Collection<?> c, Object valueToFind) Returns the indices of all occurrences of the specified value in the specified collection.static int[]indicesOfAll(Collection<?> c, Object valueToFind, int startIndex) Returns the indices of all occurrences of the specified value in the specified collection, starting the search from the specified index.static <T> int[]indicesOfAll(Collection<? extends T> c, Predicate<? super T> predicate) Returns the indices of all elements in the specified collection that match the given predicate.static <T> int[]indicesOfAll(Collection<? extends T> c, Predicate<? super T> predicate, int fromIndex) Returns the indices of all elements in the specified collection that match the given predicate, starting the search from the specified index.static <T> int[]indicesOfAll(T[] a, Predicate<? super T> predicate) Returns the indices of all elements in the specified array that match the given predicate.static <T> int[]indicesOfAll(T[] a, Predicate<? super T> predicate, int startIndex) Returns the indices of all elements in the specified array that match the given predicate, starting the search from the specified index.static <T extends Comparable<? super T>>
int[]indicesOfAllMax(Collection<? extends T> c) Returns the indices of all maximum elements in the specified collection.static <T> int[]indicesOfAllMax(Collection<? extends T> c, Comparator<? super T> cmp) Returns the indices of all maximum elements in the specified collection using the provided comparator.static <T extends Comparable<? super T>>
int[]indicesOfAllMax(T[] a) Returns the indices of all maximum elements in the specified array.static <T> int[]indicesOfAllMax(T[] a, Comparator<? super T> cmp) Returns the indices of all maximum elements in the specified array using the provided comparator.static <T extends Comparable<? super T>>
int[]indicesOfAllMin(Collection<? extends T> c) Returns the indices of all minimum elements in the specified collection.static <T> int[]indicesOfAllMin(Collection<? extends T> c, Comparator<? super T> cmp) Returns the indices of all minimum elements in the specified collection using the provided comparator.static <T extends Comparable<? super T>>
int[]indicesOfAllMin(T[] a) Returns the indices of all minimum elements in the specified array.static <T> int[]indicesOfAllMin(T[] a, Comparator<? super T> cmp) Returns the indices of all minimum elements in the specified array using the provided comparator.static boolean[]insert(boolean[] a, int index, boolean elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static byte[]insert(byte[] a, int index, byte elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static char[]insert(char[] a, int index, char elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static double[]insert(double[] a, int index, double elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static float[]insert(float[] a, int index, float elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static int[]insert(int[] a, int index, int elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static long[]insert(long[] a, int index, long elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static short[]insert(short[] a, int index, short elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static String[]Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static StringReturns a new String with chars copied from the specified String and the specified String inserted at the specified index.static <T> T[]insert(T[] a, int index, T elementToInsert) Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.static boolean[]insertAll(boolean[] a, int index, boolean... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static byte[]insertAll(byte[] a, int index, byte... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static char[]insertAll(char[] a, int index, char... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static double[]insertAll(double[] a, int index, double... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static float[]insertAll(float[] a, int index, float... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static int[]insertAll(int[] a, int index, int... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static long[]insertAll(long[] a, int index, long... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static short[]insertAll(short[] a, int index, short... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static String[]Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static <T> booleaninsertAll(List<T> list, int index, Collection<? extends T> elementsToInsert) Inserts the specified elements at the specified position in the list.static <T> booleanInserts the specified elements at the specified position in the list.static <T> T[]insertAll(T[] a, int index, T... elementsToInsert) Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.static boolean[]intersection(boolean[] a, boolean[] b) Returns the elements in the specified boolean arrays a and b that are present in both arrays.static byte[]intersection(byte[] a, byte[] b) Returns the elements in the specified byte arrays a and b that are present in both arrays.static char[]intersection(char[] a, char[] b) Returns the elements in the specified char arrays a and b that are present in both arrays.static double[]intersection(double[] a, double[] b) Returns the elements in the specified double arrays a and b that are present in both arrays.static float[]intersection(float[] a, float[] b) Returns the elements in the specified float arrays a and b that are present in both arrays.static int[]intersection(int[] a, int[] b) Returns the elements in the specified int arrays a and b that are present in both arrays.static long[]intersection(long[] a, long[] b) Returns the elements in the specified long arrays a and b that are present in both arrays.static short[]intersection(short[] a, short[] b) Returns the elements in the specified short arrays a and b that are present in both arrays.static <T> List<T> intersection(Collection<? extends Collection<? extends T>> c) Returns the elements that are present in all collections within the specified collection of collections.static <T> List<T> intersection(Collection<? extends T> a, Collection<?> b) Returns the elements in the specified collections a and b that are present in both collections.static <T> List<T> intersection(Collection<? extends T> a, Collection<?> b, boolean ignoreOcurrences) Return only the elements in the first collection that are contained in the specified second collection.static <T> List<T> intersection(T[] a, Object[] b) Returns the elements in the specified arrays a and b that are present in both arrays.static <T extends Comparable<? super T>>
booleanisBetween(T value, T min, T max) Deprecated.replaced bygtAndLt(Comparable, Comparable, Comparable)static <T> booleanisBetween(T value, T min, T max, Comparator<? super T> cmp) Deprecated.replaced bygtAndLt(Comparable, Comparable, Comparable, Comparator)static booleanisBlank(CharSequence cs) Checks if the specifiedCharSequenceisnull, empty, or contains only whitespace characters.static booleanisEmpty(boolean[] a) Checks if the specified boolean array isnullor empty.static booleanisEmpty(byte[] a) Checks if the specified byte array isnullor empty.static booleanisEmpty(char[] a) Checks if the specified char array isnullor empty.static booleanisEmpty(double[] a) Checks if the specified double array isnullor empty.static booleanisEmpty(float[] a) Checks if the specified float array isnullor empty.static booleanisEmpty(int[] a) Checks if the specified int array isnullor empty.static booleanisEmpty(long[] a) Checks if the specified long array isnullor empty.static booleanisEmpty(short[] a) Checks if the specified short array isnullor empty.static booleanChecks if the specifiedDataSetisnullor empty.static booleanChecks if the specifiedMultimapisnullor empty.static booleanChecks if the specifiedMultisetisnullor empty.static booleanisEmpty(PrimitiveList list) Checks if the specifiedPrimitiveListisnullor empty.static booleanisEmpty(CharSequence cs) Checks if the specifiedCharSequenceisnullor empty.static booleanChecks if the specified iterable isnullor empty.static booleanChecks if the specified object array isnullor empty.static booleanisEmpty(Collection<?> c) Checks if the specifiedCollectionisnullor empty.static booleanChecks if the specified iterator isnullor empty.static booleanChecks if the specifiedMapisnullor empty.static booleanisEqualCollection(Collection<?> a, Collection<?> b) Returnstrueif the givenCollections contain exactly the same elements with exactly the same cardinalities.static booleanReturnstrueif the specifiedbooleanisBoolean.FALSE, notnullorBoolean.TRUE.static booleanisNotFalse(Boolean bool) Returnstrueif the specifiedbooleanisnullorBoolean.TRUE.static booleanReturnstrueif the specifiedbooleanisnullorBoolean.FALSE.static booleanisProperSubCollection(Collection<?> subColl, Collection<?> coll) Returnstrueif subColl is a proper sub-collection of coll, that is, if the cardinality of e in subColl is less than or equal to the cardinality of e in coll, for each element e in subColl, and there is at least one element f such that the cardinality of f in coll is strictly greater than the cardinality of f in subColl.static booleanisSorted(boolean[] a) Checks if the specified boolean array is sorted in ascending order.static booleanisSorted(boolean[] a, int fromIndex, int toIndex) Checks if the specified range of the boolean array is sorted in ascending order.static booleanisSorted(byte[] a) Checks if the specified byte array is sorted in ascending order.static booleanisSorted(byte[] a, int fromIndex, int toIndex) Checks if the specified range of the byte array is sorted in ascending order.static booleanisSorted(char[] a) Checks if the specified char array is sorted in ascending order.static booleanisSorted(char[] a, int fromIndex, int toIndex) Checks if the specified range of the char array is sorted in ascending order.static booleanisSorted(double[] a) Checks if the specified double array is sorted in ascending order.static booleanisSorted(double[] a, int fromIndex, int toIndex) Checks if the specified range of the double array is sorted in ascending order.static booleanisSorted(float[] a) Checks if the specified float array is sorted in ascending order.static booleanisSorted(float[] a, int fromIndex, int toIndex) Checks if the specified range of the float array is sorted in ascending order.static booleanisSorted(int[] a) Checks if the specified integer array is sorted in ascending order.static booleanisSorted(int[] a, int fromIndex, int toIndex) Checks if the specified range of the integer array is sorted in ascending order.static booleanisSorted(long[] a) Checks if the specified long array is sorted in ascending order.static booleanisSorted(long[] a, int fromIndex, int toIndex) Checks if the specified range of the long array is sorted in ascending order.static booleanisSorted(short[] a) Checks if the specified byte short is sorted in ascending order.static booleanisSorted(short[] a, int fromIndex, int toIndex) Checks if the specified range of the short array is sorted in ascending order.static <T extends Comparable<? super T>>
booleanisSorted(Collection<? extends T> c) Checks if the collection is sorted in ascending order (wherenullis smallest).static <T extends Comparable<? super T>>
booleanisSorted(Collection<? extends T> c, int fromIndex, int toIndex) Checks if the specified range of the collection is sorted in ascending order (wherenullis smallest).static <T> booleanisSorted(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) Checks if the specified range of the collection is sorted according to the order induced by the specified comparator.static <T> booleanisSorted(Collection<? extends T> c, Comparator<? super T> cmp) Checks if the collection is sorted according to the order induced by the specified comparator.static <T extends Comparable<? super T>>
booleanisSorted(T[] a) Checks if the specified array is sorted in ascending order (wherenullis smallest).static <T extends Comparable<? super T>>
booleanisSorted(T[] a, int fromIndex, int toIndex) Checks if the specified range of the array is sorted in ascending order (wherenullis smallest).static <T> booleanisSorted(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Checks if the specified range of the array is sorted according to the order induced by the specified comparator.static <T> booleanisSorted(T[] a, Comparator<? super T> cmp) Checks if the array is sorted according to the order induced by the specified comparator.static booleanisSubCollection(Collection<?> subColl, Collection<?> coll) Returnstrueif subColl is a sub-collection of coll, that is, if the cardinality of e in subColl is less than or equal to the cardinality of e in coll, for each element e in subColl.static booleanReturnstrueif the specifiedbooleanisBoolean.TRUE, notnullorBoolean.FALSE.static <T> Iterator<T> Returns an iterator over the elements in the specified iterable.static <T> ObjIterator<T> iterate(T[] a) Returns an iterator over the elements in the specified array.static <T> ObjIterator<T> iterate(T[] a, int fromIndex, int toIndex) Returns an iterator over the elements within specified range in the given array.iterateAll(Collection<? extends Iterable<? extends T>> iterables) Returns a list of iterators for each iterable in the specified collection of iterables.static StringConverts the given JSON string to its XML string representation.static StringConverts the given JSON string to its XML string representation.static bytekthLargest(byte[] a, int k) Returns the k-th largest element in the specified array.static bytekthLargest(byte[] a, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input array.static charkthLargest(char[] a, int k) Returns the k-th largest element in the specified array.static charkthLargest(char[] a, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input array.static doublekthLargest(double[] a, int k) Returns the k-th largest element in the specified array.static doublekthLargest(double[] a, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input array.static floatkthLargest(float[] a, int k) Returns the k-th largest element in the specified array.static floatkthLargest(float[] a, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input array.static intkthLargest(int[] a, int k) Returns the k-th largest element in the specified array.static intkthLargest(int[] a, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input array.static longkthLargest(long[] a, int k) Returns the k-th largest element in the specified array.static longkthLargest(long[] a, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input array.static shortkthLargest(short[] a, int k) Returns the k-th largest element in the specified array.static shortkthLargest(short[] a, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input array.static <T extends Comparable<? super T>>
TkthLargest(Collection<? extends T> c, int k) Returns the k-th largest element in the specified collection.static <T extends Comparable<? super T>>
TkthLargest(Collection<? extends T> c, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input collection.static <T> TkthLargest(Collection<? extends T> c, int fromIndex, int toIndex, int k, Comparator<? super T> cmp) Returns the k-th largest element within the specified range in the input collection according to the provided comparator.static <T> TkthLargest(Collection<? extends T> c, int k, Comparator<? super T> cmp) Returns the k-th largest element in the specified collection according to the provided comparator.static <T extends Comparable<? super T>>
TkthLargest(T[] a, int k) Returns the k-th largest element in the specified array.static <T extends Comparable<? super T>>
TkthLargest(T[] a, int fromIndex, int toIndex, int k) Returns the k-th largest element within the specified range in the input array.static <T> TkthLargest(T[] a, int fromIndex, int toIndex, int k, Comparator<? super T> cmp) Returns the k-th largest element within the specified range in the input array according to the provided comparator.static <T> TkthLargest(T[] a, int k, Comparator<? super T> cmp) Returns the k-th largest element in the specified array according to the provided comparator.static <T> u.Nullable<T> lastElement(Iterable<? extends T> c) Returns the last element in the given Iterable wrapped in aNullable.static <T> u.Nullable<T> lastElement(Iterator<? extends T> iter) Returns the last element in the given Iterator wrapped in aNullable.static <T> List<T> lastElements(Iterable<? extends T> c, int n) Returns a list containing the last n elements from the given Iterable.static <T> List<T> lastElements(Iterator<? extends T> iter, int n) Returns a list containing the last n elements from the given Iterator.static <K,V> u.Optional <Map.Entry<K, V>> Returns the last entry from the given map.static intlastIndexOf(boolean[] a, boolean valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(boolean[] a, boolean valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(byte[] a, byte valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(byte[] a, byte valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(char[] a, char valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(char[] a, char valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(double[] a, double valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(double[] a, double valueToFind, double tolerance) Finds the last index of the given value within a given tolerance in the array.static intlastIndexOf(double[] a, double valueToFind, double tolerance, int startIndexFromBack) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(double[] a, double valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(float[] a, float valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(float[] a, float valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(int[] a, int valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(int[] a, int valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(long[] a, long valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(long[] a, long valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(short[] a, short valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(short[] a, short valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(Object[] a, Object valueToFind) Returns the index of the last occurrence of the specified value in the array.static intlastIndexOf(Object[] a, Object valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.static intlastIndexOf(Collection<?> c, Object valueToFind) Returns the index of the last occurrence of the specified value in the specified collection.static intlastIndexOf(Collection<?> c, Object valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the specified collection, starting the search backwards from the specified index.static intlastIndexOfIgnoreCase(String[] a, String valueToFind) Returns the index of the last occurrence of the specified string in the array, ignoring case considerations.static intlastIndexOfIgnoreCase(String[] a, String valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified string in the array, ignoring case considerations, starting the search backwards from the specified index.static intlastIndexOfSubList(List<?> sourceList, List<?> subListToFind) Returns the index of the last occurrence of the specified sublist in the source list.static intlastIndexOfSubList(List<?> sourceList, List<?> subListToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified sublist in the source list, starting the search backwards from the specified index.static <T> u.Optional<T> lastNonNull(Iterable<? extends T> c) Returns the lastnon-nullvalue from the provided iterable.static <T> u.Optional<T> lastNonNull(Iterator<? extends T> iter) Returns the lastnon-nullvalue from the provided iterator.static <T> u.Optional<T> lastNonNull(T... a) Returns the lastnon-nullvalue from the provided array of values.static <T> u.Optional<T> lastNonNull(T a, T b) Returns the lastnon-nullvalue from the provided values.static <T> u.Optional<T> lastNonNull(T a, T b, T c) Returns the lastnon-nullvalue from the provided values.static <T> TlastOrDefaultIfEmpty(Iterable<? extends T> c, T defaultValueForEmpty) Returns the last element of the given iterable if it is not empty, otherwise returns the specified default value.static <T> TlastOrDefaultIfEmpty(Iterator<? extends T> iter, T defaultValueForEmpty) Returns the last element of the given iterator if it is not empty, otherwise returns the specified default value.static <T> TlastOrDefaultIfEmpty(T[] a, T defaultValueForEmpty) Returns the last element of the given array if it is not empty, otherwise returns the specified default value.static <T> TlastOrNullIfEmpty(Iterable<? extends T> c) Returns the last element of the given iterable if it is not empty, otherwise returnsnull.static <T> TlastOrNullIfEmpty(Iterator<? extends T> iter) Returns the last element of the given iterator if it is not empty, otherwise returnsnull.static <T> TlastOrNullIfEmpty(T[] a) Returns the last element of the given array if it is not empty, otherwise returnsnull.static <T> Supplier<T> Creates a lazy-initialized supplier from the provided supplier.static <T,E extends Exception>
Throwables.Supplier<T, E> lazyInitialize(Throwables.Supplier<T, E> supplier) Creates a lazy-initialized supplier from the provided supplier.static intlen(boolean[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intlen(byte[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intlen(char[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intlen(double[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intlen(float[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intlen(int[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intlen(long[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intlen(short[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intlen(CharSequence s) Returns the length of the specifiedCharSequence, or0if it's empty ornull.static intReturns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static <T extends Comparable<? super T>>
booleanlessEqual(T a, T b) Compares two comparable objects to determine if the first is less than or equal to the second.static <T> booleanlessEqual(T a, T b, Comparator<? super T> cmp) Compares two objects using the specified comparator to determine if the first is less than or equal to the second.static <T extends Comparable<? super T>>
booleanlessThan(T a, T b) Compares two comparable objects to determine if the first is less than the second.static <T> booleanlessThan(T a, T b, Comparator<? super T> cmp) Compares two objects using the specified comparator to determine if the first is less than the second.static <T,R> List <R> Transforms the elements in the specified iterable from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R, C extends Collection<R>>
Cmap(Iterable<? extends T> c, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified iterable from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R> List <R> map(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper) Transforms the elements within the specified range in the input collection from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R, C extends Collection<R>>
Cmap(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Transforms the elements within the specified range in the input collection from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R> List <R> Transforms the elements in the specified iterator from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R, C extends Collection<R>>
Cmap(Iterator<? extends T> iter, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified iterator from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R> List <R> Transforms the elements within the specified range in the input array from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R, C extends Collection<R>>
Cmap(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Transforms the elements within the specified range in the input array from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R> List <R> Transforms the elements in the specified array from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R, C extends Collection<R>>
Cmap(T[] a, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified array from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.static <T,R> List <R> mapAndFilter(Iterable<? extends T> c, Function<? super T, ? extends R> mapper, Predicate<? super R> filter) Maps and filters the elements in the given iterable.static <T,R, C extends Collection<R>>
CmapAndFilter(Iterable<? extends T> c, Function<? super T, ? extends R> mapper, Predicate<? super R> filter, IntFunction<? extends C> supplier) Maps and filters the elements in the given iterable.static <T> boolean[]mapToBoolean(Collection<? extends T> c, int fromIndex, int toIndex, ToBooleanFunction<? super T> mapper) Transforms the elements within the specified range in the input collection to boolean values using the specifiedToBooleanFunction.static <T> boolean[]mapToBoolean(Collection<? extends T> c, ToBooleanFunction<? super T> mapper) Transforms the elements of the specified collection to boolean values using the specifiedToBooleanFunction.static <T> boolean[]mapToBoolean(T[] a, int fromIndex, int toIndex, ToBooleanFunction<? super T> mapper) Transforms the elements within the specified range in the input array to boolean values using the specifiedToBooleanFunction.static <T> boolean[]mapToBoolean(T[] a, ToBooleanFunction<? super T> mapper) Transforms the elements of the specified array to boolean values using the specifiedToBooleanFunction.static <T> byte[]mapToByte(Collection<? extends T> c, int fromIndex, int toIndex, ToByteFunction<? super T> mapper) Transforms the elements within the specified range in the input collection to byte values using the specifiedToByteFunction.static <T> byte[]mapToByte(Collection<? extends T> c, ToByteFunction<? super T> mapper) Transforms the elements of the specified collection to byte values using the specifiedToByteFunction.static <T> byte[]mapToByte(T[] a, int fromIndex, int toIndex, ToByteFunction<? super T> mapper) Transforms the elements within the specified range in the input array to byte values using the specifiedToByteFunction.static <T> byte[]mapToByte(T[] a, ToByteFunction<? super T> mapper) Transforms the elements of the specified array to byte values using the specifiedToByteFunction.static <T> char[]mapToChar(Collection<? extends T> c, int fromIndex, int toIndex, ToCharFunction<? super T> mapper) Transforms the elements within the specified range in the input collection to char values using the specifiedToCharFunction.static <T> char[]mapToChar(Collection<? extends T> c, ToCharFunction<? super T> mapper) Transforms the elements of the specified collection to char values using the specifiedToCharFunction.static <T> char[]mapToChar(T[] a, int fromIndex, int toIndex, ToCharFunction<? super T> mapper) Transforms the elements within the specified range in the input array to char values using the specifiedToCharFunction.static <T> char[]mapToChar(T[] a, ToCharFunction<? super T> mapper) Transforms the elements of the specified array to char values using the specifiedToCharFunction.static double[]mapToDouble(int[] a, IntToDoubleFunction mapper) Transforms the int values in the specified array to double values using the specifiedIntToDoubleFunction.static double[]mapToDouble(long[] a, LongToDoubleFunction mapper) Transforms the long values in the specified array to double values using the specifiedIntToDoubleFunction.static <T> double[]mapToDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> mapper) Transforms the elements within the specified range in the input collection to double values using the specifiedToDoubleFunction.static <T> double[]mapToDouble(Collection<? extends T> c, ToDoubleFunction<? super T> mapper) Transforms the elements of the specified collection to double values using the specifiedToDoubleFunction.static <T> double[]mapToDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> mapper) Transforms the elements within the specified range in the input array to double values using the specifiedToDoubleFunction.static <T> double[]mapToDouble(T[] a, ToDoubleFunction<? super T> mapper) Transforms the elements of the specified array to double values using the specifiedToDoubleFunction.static <T> float[]mapToFloat(Collection<? extends T> c, int fromIndex, int toIndex, ToFloatFunction<? super T> mapper) Transforms the elements within the specified range in the input collection to float values using the specifiedToFloatFunction.static <T> float[]mapToFloat(Collection<? extends T> c, ToFloatFunction<? super T> mapper) Transforms the elements of the specified collection to float values using the specifiedToFloatFunction.static <T> float[]mapToFloat(T[] a, int fromIndex, int toIndex, ToFloatFunction<? super T> mapper) Transforms the elements within the specified range in the input array to float values using the specifiedToFloatFunction.static <T> float[]mapToFloat(T[] a, ToFloatFunction<? super T> mapper) Transforms the elements of the specified array to float values using the specifiedToFloatFunction.static int[]mapToInt(double[] a, DoubleToIntFunction mapper) Transforms the double values in the specified array to int values using the specifiedDoubleToIntFunction.static int[]mapToInt(long[] a, LongToIntFunction mapper) Transforms the long values in the specified array to int values using the specifiedLongToIntFunction.static <T> int[]mapToInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> mapper) Transforms the elements within the specified range in the input collection to int values using the specifiedToIntFunction.static <T> int[]mapToInt(Collection<? extends T> c, ToIntFunction<? super T> mapper) Transforms the elements of the specified collection to int values using the specifiedToIntFunction.static <T> int[]mapToInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> mapper) Transforms the elements within the specified range in the input array to int values using the specifiedToIntFunction.static <T> int[]mapToInt(T[] a, ToIntFunction<? super T> mapper) Transforms the elements of the specified array to int values using the specifiedToIntFunction.static long[]mapToLong(double[] a, DoubleToLongFunction mapper) Transforms the double values in the specified array to long values using the specifiedDoubleToLongFunction.static long[]mapToLong(int[] a, IntToLongFunction mapper) Transforms the int values in the specified array to long values using the specifiedIntToLongFunction.static <T> long[]mapToLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> mapper) Transforms the elements within the specified range in the input collection to long values using the specifiedToLongFunction.static <T> long[]mapToLong(Collection<? extends T> c, ToLongFunction<? super T> mapper) Transforms the elements of the specified collection to long values using the specifiedToLongFunction.static <T> long[]mapToLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> mapper) Transforms the elements within the specified range in the input array to long values using the specifiedToLongFunction.static <T> long[]mapToLong(T[] a, ToLongFunction<? super T> mapper) Transforms the elements of the specified array to long values using the specifiedToLongFunction.static <T> short[]mapToShort(Collection<? extends T> c, int fromIndex, int toIndex, ToShortFunction<? super T> mapper) Transforms the elements within the specified range in the input collection to short values using the specifiedToShortFunction.static <T> short[]mapToShort(Collection<? extends T> c, ToShortFunction<? super T> mapper) Transforms the elements of the specified collection to short values using the specifiedToShortFunction.static <T> short[]mapToShort(T[] a, int fromIndex, int toIndex, ToShortFunction<? super T> mapper) Transforms the elements within the specified range in the input array to short values using the specifiedToShortFunction.static <T> short[]mapToShort(T[] a, ToShortFunction<? super T> mapper) Transforms the elements of the specified array to short values using the specifiedToShortFunction.static bytemax(byte... a) Returns the biggest byte value in the specified array of byte values.static bytemax(byte[] a, int fromIndex, int toIndex) Returns the biggest byte value within the given range in the specified array of byte values.static bytemax(byte a, byte b) Returns the bigger of two byte values.static bytemax(byte a, byte b, byte c) Returns the biggest value among the provided values.static charmax(char... a) Returns the biggest char value in the specified array of char values.static charmax(char[] a, int fromIndex, int toIndex) Returns the biggest char value within the given range in the specified array of char values.static charmax(char a, char b) Returns the bigger of two char values.static charmax(char a, char b, char c) Returns the biggest value among the provided values.static doublemax(double... a) Returns the biggest double value in the specified array of double values.static doublemax(double[] a, int fromIndex, int toIndex) Returns the biggest double value within the given range in the specified array of double values.static doublemax(double a, double b) Returns the bigger of two double values.static doublemax(double a, double b, double c) Returns the biggest value among the provided values.static floatmax(float... a) Returns the biggest float value in the specified array of float values.static floatmax(float[] a, int fromIndex, int toIndex) Returns the biggest float value within the given range in the specified array of float values.static floatmax(float a, float b) Returns the bigger of two float values.static floatmax(float a, float b, float c) Returns the biggest value among the provided values.static intmax(int... a) Returns the biggest int value in the specified array of int values.static intmax(int[] a, int fromIndex, int toIndex) Returns the biggest int value within the given range in the specified array of int values.static intmax(int a, int b) Returns the bigger of two int values.static intmax(int a, int b, int c) Returns the biggest value among the provided values.static longmax(long... a) Returns the biggest long value in the specified array of long values.static longmax(long[] a, int fromIndex, int toIndex) Returns the biggest long value within the given range in the specified array of long values.static longmax(long a, long b) Returns the bigger of two long values.static longmax(long a, long b, long c) Returns the biggest value among the provided values.static shortmax(short... a) Returns the biggest short value in the specified array of short values.static shortmax(short[] a, int fromIndex, int toIndex) Returns the biggest short value within the given range in the specified array of short values.static shortmax(short a, short b) Returns the bigger of two short values.static shortmax(short a, short b, short c) Returns the biggest value among the provided values.static <T extends Comparable<? super T>>
TReturns the biggest element in the specified iterable based on their natural ordering.static <T> Tmax(Iterable<? extends T> c, Comparator<? super T> cmp) Returns the biggest element in the specified iterable according to the provided comparator.static <T extends Comparable<? super T>>
Tmax(Collection<? extends T> c, int fromIndex, int toIndex) Returns the biggest element within the given range in the specified collection according to the provided comparator.static <T> Tmax(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the biggest element within the given range in the specified collection according to the provided comparator.static <T extends Comparable<? super T>>
TReturns the biggest element in the specified iterator based on their natural ordering.static <T> Tmax(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns the biggest element in the specified iterator according to the provided comparator.static <T extends Comparable<? super T>>
Tmax(T[] a) Returns the biggest element in the specified array based on their natural ordering.static <T extends Comparable<? super T>>
Tmax(T[] a, int fromIndex, int toIndex) Returns the biggest element within the given range in the specified array based on their natural ordering.static <T> Tmax(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the biggest element within the given range in the specified array according to the provided comparator.static <T> Tmax(T[] a, Comparator<? super T> cmp) Returns the biggest element in the specified array according to the provided comparator.static <T extends Comparable<? super T>>
Tmax(T a, T b) Returns the bigger value of the two provided values based on their natural ordering.static <T> Tmax(T a, T b, Comparator<? super T> cmp) Returns the bigger value of the two provided values according to the provided comparator.static <T extends Comparable<? super T>>
Tmax(T a, T b, T c) Returns the biggest value among the provided values based on their natural ordering.static <T> Tmax(T a, T b, T c, Comparator<? super T> cmp) Returns the biggest value among the provided values according to the provided comparator.static <T extends Comparable<? super T>>
List<T> Returns a list containing the biggest elements in the specified iterable based on their natural ordering.static <T> List<T> maxAll(Iterable<? extends T> c, Comparator<? super T> cmp) Returns a list containing all biggest elements in the specified iterable according to the provided comparator.static <T extends Comparable<? super T>>
List<T> Returns a list containing the biggest elements in the specified iterator based on their natural ordering.static <T> List<T> maxAll(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns a list containing all biggest elements in the specified iterator according to the provided comparator.static <T extends Comparable<? super T>>
List<T> maxAll(T[] a) Returns a list containing the biggest elements in the specified array based on their natural ordering.static <T> List<T> maxAll(T[] a, Comparator<? super T> cmp) Returns a list containing all biggest elements in the specified array according to the provided comparator.static <T> doublemaxDoubleOrDefaultIfEmpty(Iterable<? extends T> c, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximum double value extracted from the iterable or a default value if the iterable isnullor empty.static <T> doublemaxDoubleOrDefaultIfEmpty(Iterator<? extends T> iter, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximum double value extracted from the iterator or a default value if the iterator isnullor empty.static <T> doublemaxDoubleOrDefaultIfEmpty(T[] a, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximum double value extracted from the array or a default value if the array isnullor empty.static <T> intmaxIntOrDefaultIfEmpty(Iterable<? extends T> c, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximum integer value extracted from the iterable or a default value if the iterable isnullor empty.static <T> intmaxIntOrDefaultIfEmpty(Iterator<? extends T> iter, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximum integer value extracted from the iterator or a default value if the iterator isnullor empty.static <T> intmaxIntOrDefaultIfEmpty(T[] a, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximum integer value extracted from the array or a default value if the array isnullor empty.static <T> longmaxLongOrDefaultIfEmpty(Iterable<? extends T> c, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximum long value extracted from the iterable or a default value if the iterable isnullor empty.static <T> longmaxLongOrDefaultIfEmpty(Iterator<? extends T> iter, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximum long value extracted from the iterator or a default value if the iterator isnullor empty.static <T> longmaxLongOrDefaultIfEmpty(T[] a, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximum long value extracted from the array or a default value if the array isnullor empty.static <T,R extends Comparable<? super R>>
RmaxOrDefaultIfEmpty(Iterable<? extends T> c, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified iterable or a default value if the iterable isnullor empty.static <T,R extends Comparable<? super R>>
RmaxOrDefaultIfEmpty(Iterator<? extends T> iter, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified iterator or a default value if the iterator isnullor empty.static <T,R extends Comparable<? super R>>
RmaxOrDefaultIfEmpty(T[] a, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified array or a default value if the array isnullor empty.static bytemedian(byte... a) Returns the(sizeOfRange / 2 + 1)largest value in the specified array.static bytemedian(byte[] a, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified arraystatic bytemedian(byte a, byte b, byte c) Returns the median value of the three specified byte values.static charmedian(char... a) Returns the(sizeOfRange / 2 + 1)largest value in the specified array.static charmedian(char[] a, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified arraystatic charmedian(char a, char b, char c) Returns the median value of the three specified char values.static doublemedian(double... a) Returns the(sizeOfRange / 2 + 1)largest value in the specified array.static doublemedian(double[] a, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified arraystatic doublemedian(double a, double b, double c) Returns the median value of the three specified double values.static floatmedian(float... a) Returns the(sizeOfRange / 2 + 1)largest value in the specified array.static floatmedian(float[] a, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified arraystatic floatmedian(float a, float b, float c) Returns the median value of the three specified float values.static intmedian(int... a) Returns the(sizeOfRange / 2 + 1)largest value in the specified array.static intmedian(int[] a, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified arraystatic intmedian(int a, int b, int c) Returns the median value of the three specified int values.static longmedian(long... a) Returns the(sizeOfRange / 2 + 1)largest value in the specified array.static longmedian(long[] a, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified arraystatic longmedian(long a, long b, long c) Returns the median value of the three specified long values.static shortmedian(short... a) Returns the(sizeOfRange / 2 + 1)largest value in the specified array.static shortmedian(short[] a, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified arraystatic shortmedian(short a, short b, short c) Returns the median value of the three specified short values.static <T extends Comparable<? super T>>
Tmedian(Collection<? extends T> c) Returns the(sizeOfRange / 2 + 1)largest element in the specified collection according to the provided comparator.static <T extends Comparable<? super T>>
Tmedian(Collection<? extends T> c, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest element within the specified range in the input collection according to the provided comparator.static <T> Tmedian(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the(sizeOfRange / 2 + 1)largest element within the specified range in the input collection according to the provided comparator.static <T> Tmedian(Collection<? extends T> c, Comparator<? super T> cmp) Returns the(sizeOfRange / 2 + 1)largest element in the specified collection according to the provided comparator.static <T extends Comparable<? super T>>
Tmedian(T[] a) Returns the(sizeOfRange / 2 + 1)largest value in the specified array.static <T extends Comparable<? super T>>
Tmedian(T[] a, int fromIndex, int toIndex) Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified arraystatic <T> Tmedian(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the(sizeOfRange / 2 + 1)largest element within the specified range in the input array according to the provided comparator.static <T> Tmedian(T[] a, Comparator<? super T> cmp) Returns the(sizeOfRange / 2 + 1)largest element in the specified array according to the provided comparator.static <T extends Comparable<? super T>>
Tmedian(T a, T b, T c) Returns the median of the provided values based on their natural ordering.static <T> Tmedian(T a, T b, T c, Comparator<? super T> cmp) Returns the median of the provided values according to the provided comparator.static DataSetMerges two given DataSets into a single DataSet.static DataSetMerges three given DataSets into a single DataSet.static <T> List<T> merge(Iterable<? extends T> a, Iterable<? extends T> b, BiFunction<? super T, ? super T, MergeResult> nextSelector) Merges two the input iterables into a list based where the order of the elements is determined by the given selector function.static <T> TMerges the properties from the source object into the target object.static <T> Tmerge(Object sourceBean, T targetBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames) Merges the properties from the source object into the target object, except the properties specified in theignoredPropNamesset.static <T> Tmerge(Object sourceBean, T targetBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames, BinaryOperator<?> mergeFunc) Merges the properties from the source object into the target object using the specified merge function, except the properties specified in theignoredPropNamesset.static <T> Tmerge(Object sourceBean, T targetBean, Collection<String> selectPropNames) Merges the selected properties from the source object into the target object.static <T> Tmerge(Object sourceBean, T targetBean, Collection<String> selectPropNames, BinaryOperator<?> mergeFunc) Merges the selected properties from the source object into the target object using the specified merge function.static <T> Tmerge(Object sourceBean, T targetBean, Collection<String> selectPropNames, Function<String, String> propNameConverter) Merges the selected properties from the source object into the target object.static <T> Tmerge(Object sourceBean, T targetBean, Collection<String> selectPropNames, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) Merges the selected properties from the source object into the target object using the specified merge function.static <T> Tmerge(Object sourceBean, T targetBean, BinaryOperator<?> mergeFunc) Merges the properties from the source object into the target object using the specified merge function.static <T> Tmerge(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter) Merges the filtered properties from the source object into the target object, The source object's properties will overwrite the same properties in the target object.static <T> Tmerge(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter, BinaryOperator<?> mergeFunc) Merges the filtered properties from the source object into the target object using the specified merge function.static <T> Tmerge(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter, Function<String, String> propNameConverter) Merges the filtered properties from the source object into the target object using the specified merge function.static <T> Tmerge(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) Merges the filtered properties from the source object into the target object using the specified merge function.static <T> Tmerge(Object sourceBean, T targetBean, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) Merges the properties from the source object into the target object using the specified merge function.static DataSetmerge(Collection<? extends DataSet> dss) Merges a collection of DataSets into a single DataSet.static DataSetmerge(Collection<? extends DataSet> dss, boolean requiresSameColumns) Merges a collection of DataSets into a single DataSet.static <T> List<T> merge(Collection<? extends Iterable<? extends T>> c, BiFunction<? super T, ? super T, MergeResult> nextSelector) Merges multiple iterables into a list based where the order of the elements is determined by the given selector function.static <T,C extends Collection<T>>
Cmerge(Collection<? extends Iterable<? extends T>> c, BiFunction<? super T, ? super T, MergeResult> nextSelector, IntFunction<? extends C> supplier) Merges multiple iterables into a list based where the order of the elements is determined by the given selector function.static <T> List<T> merge(T[] a, T[] b, BiFunction<? super T, ? super T, MergeResult> nextSelector) Merges two the input arrays into a list based where the order of the elements is determined by the given selector function.static bytemin(byte... a) Returns the smallest byte value in the specified array.static bytemin(byte[] a, int fromIndex, int toIndex) Returns the smallest byte value within the specified range in the input array.static bytemin(byte a, byte b) Returns the smaller of two input byte values.static bytemin(byte a, byte b, byte c) Returns the smallest of the three input byte values.static charmin(char... a) Returns the smallest char value in the specified array.static charmin(char[] a, int fromIndex, int toIndex) Returns the smallest char value within the specified range in the input array.static charmin(char a, char b) Returns the smaller of two input char values.static charmin(char a, char b, char c) Returns the smallest of the three input char values.static doublemin(double... a) Returns the smallest double value in the specified array.static doublemin(double[] a, int fromIndex, int toIndex) Returns the smallest double value within the specified range in the input array.static doublemin(double a, double b) Returns the smaller of two input double values.static doublemin(double a, double b, double c) Returns the smallest of the three input double values.static floatmin(float... a) Returns the smallest float value in the specified array.static floatmin(float[] a, int fromIndex, int toIndex) Returns the smallest float value within the specified range in the input array.static floatmin(float a, float b) Returns the smaller of two input float values.static floatmin(float a, float b, float c) Returns the smallest of the three input float values.static intmin(int... a) Returns the smallest int value in the specified array.static intmin(int[] a, int fromIndex, int toIndex) Returns the smallest int value within the specified range in the input array.static intmin(int a, int b) Returns the smaller of two input int values.static intmin(int a, int b, int c) Returns the smallest of the three input int values.static longmin(long... a) Returns the smallest long value in the specified array.static longmin(long[] a, int fromIndex, int toIndex) Returns the smallest long value within the specified range in the input array.static longmin(long a, long b) Returns the smaller of two input long values.static longmin(long a, long b, long c) Returns the smallest of the three input long values.static shortmin(short... a) Returns the smallest short value in the specified array.static shortmin(short[] a, int fromIndex, int toIndex) Returns the smallest short value within the specified range in the input array.static shortmin(short a, short b) Returns the smaller of two input short values.static shortmin(short a, short b, short c) Returns the smallest of the three input short values.static <T extends Comparable<? super T>>
TReturns the smallest value in the specified iterable based on their natural ordering.static <T> Tmin(Iterable<? extends T> c, Comparator<? super T> cmp) Returns the smallest value in the specified iterable according to the provided comparator.static <T extends Comparable<? super T>>
Tmin(Collection<? extends T> c, int fromIndex, int toIndex) Returns the smallest value within the specified range in the input collection based on their natural ordering.static <T> Tmin(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the smallest value within the specified range in the input collection according to the provided comparator.static <T extends Comparable<? super T>>
TReturns the smallest value in the specified iterator based on their natural ordering.static <T> Tmin(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns the smallest value in the specified iterator according to the provided comparator.static <T extends Comparable<? super T>>
Tmin(T[] a) Returns the smallest value in the specified array based on their natural ordering.static <T extends Comparable<? super T>>
Tmin(T[] a, int fromIndex, int toIndex) Returns the smallest value within the specified range in the input array based on their natural ordering.static <T> Tmin(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Returns the smallest value within the specified range in the input array according to the provided comparator.static <T> Tmin(T[] a, Comparator<? super T> cmp) Returns the smallest value in the specified array according to the provided comparator.static <T extends Comparable<? super T>>
Tmin(T a, T b) Returns the smaller of two input comparable values.static <T> Tmin(T a, T b, Comparator<? super T> cmp) Returns the smaller of two input values based on the specified comparator.static <T extends Comparable<? super T>>
Tmin(T a, T b, T c) Returns the smallest of the three input comparable values.static <T> Tmin(T a, T b, T c, Comparator<? super T> cmp) Returns the smallest of the three input values based on the specified comparator.static <T extends Comparable<? super T>>
List<T> Returns a list containing the smallest elements in the specified iterable based on their natural ordering.static <T> List<T> minAll(Iterable<? extends T> c, Comparator<? super T> cmp) Returns a list containing the smallest elements in the specified iterable according to the provided comparator.static <T extends Comparable<? super T>>
List<T> Returns a list containing the smallest elements in the specified iterator based on their natural ordering.static <T> List<T> minAll(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns a list containing the smallest elements in the specified iterator according to the provided comparator.static <T extends Comparable<? super T>>
List<T> minAll(T[] a) Returns a list containing the smallest elements in the specified array based on their natural ordering.static <T> List<T> minAll(T[] a, Comparator<? super T> cmp) Returns a list containing the smallest elements in the specified array according to the provided comparator.static <T> doubleminDoubleOrDefaultIfEmpty(Iterable<? extends T> c, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimum double value extracted from the specified iterable or a default value if the iterable isnullor empty.static <T> doubleminDoubleOrDefaultIfEmpty(Iterator<? extends T> iter, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimum double value extracted from the specified iterator or a default value if the iterator isnullor empty.static <T> doubleminDoubleOrDefaultIfEmpty(T[] a, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimum double value extracted from the specified array or a default value if the array isnullor empty.static <T> intminIntOrDefaultIfEmpty(Iterable<? extends T> c, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimum integer value extracted from the specified iterable or a default value if the iterable isnullor empty.static <T> intminIntOrDefaultIfEmpty(Iterator<? extends T> iter, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimum integer value extracted from the specified iterator or a default value if the iterator isnullor empty.static <T> intminIntOrDefaultIfEmpty(T[] a, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimum integer value extracted from the array or a default value if the array isnullor empty.static <T> longminLongOrDefaultIfEmpty(Iterable<? extends T> c, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimum long value extracted from the specified iterable or a default value if the iterable isnullor empty.static <T> longminLongOrDefaultIfEmpty(Iterator<? extends T> iter, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimum long value extracted from the specified iterator or a default value if the iterator isnullor empty.static <T> longminLongOrDefaultIfEmpty(T[] a, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimum long value extracted from the specified array or a default value if the array isnullor empty.static <T extends Comparable<? super T>>
Pair<T, T> Returns a Pair object containing the minimum and maximum values in the specified iterable based on their natural ordering.static <T> Pair<T, T> minMax(Iterable<? extends T> c, Comparator<? super T> cmp) Returns a Pair object containing the minimum and maximum values in the specified iterable according to the provided comparator.static <T extends Comparable<? super T>>
Pair<T, T> Returns a Pair object containing the minimum and maximum values in the specified iterator based on their natural ordering.static <T> Pair<T, T> minMax(Iterator<? extends T> iter, Comparator<? super T> cmp) Returns a Pair object containing the minimum and maximum values in the specified iterator according to the provided comparator.static <T extends Comparable<? super T>>
Pair<T, T> minMax(T[] a) Returns a Pair object containing the minimum and maximum values in the specified array based on their natural ordering.static <T> Pair<T, T> minMax(T[] a, Comparator<? super T> cmp) Returns a Pair object containing the minimum and maximum values in the specified array according to the provided comparator.static <T,R extends Comparable<? super R>>
RminOrDefaultIfEmpty(Iterable<? extends T> c, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified iterable or a default value if the iterable isnullor empty.static <T,R extends Comparable<? super R>>
RminOrDefaultIfEmpty(Iterator<? extends T> iter, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified iterator or a default value if the iterator isnullor empty.static <T,R extends Comparable<? super R>>
RminOrDefaultIfEmpty(T[] a, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified array or a default value if the array isnullor empty.static intmismatch(boolean[] a, boolean[] b) Finds and returns the index of the first mismatch between two arrays.static intmismatch(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two boolean arrays starting from specified indices.static intmismatch(byte[] a, byte[] b) Finds and returns the index of the first mismatch between two arrays.static intmismatch(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two byte arrays starting from specified indices.static intmismatch(char[] a, char[] b) Finds and returns the index of the first mismatch between two arrays.static intmismatch(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two char arrays starting from specified indices.static intmismatch(double[] a, double[] b) Finds and returns the index of the first mismatch between two arrays.static intmismatch(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two double arrays starting from specified indices.static intmismatch(float[] a, float[] b) Finds and returns the index of the first mismatch between two arrays.static intmismatch(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two float arrays starting from specified indices.static intmismatch(int[] a, int[] b) Finds and returns the index of the first mismatch between two arrays.static intmismatch(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two int arrays starting from specified indices.static intmismatch(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two long arrays starting from specified indices.static intmismatch(long[] a, long[] b) Finds and returns the index of the first mismatch between two arrays.static intmismatch(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two short arrays starting from specified indices.static intmismatch(short[] a, short[] b) Finds and returns the index of the first mismatch between two arrays.static <T extends Comparable<? super T>>
intFinds and returns the index of the first mismatch between two iterables.static <T> intmismatch(Iterable<T> a, Iterable<T> b, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two iterables using the specified comparator.static <T> intmismatch(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two collections starting from specified indices.static <T> intmismatch(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two collections starting from specified indices.static <T extends Comparable<? super T>>
intFinds and returns the index of the first mismatch between two iterators.static <T> intmismatch(Iterator<T> a, Iterator<T> b, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two iterators using the specified comparator.static <T extends Comparable<? super T>>
intmismatch(T[] a, int fromIndexA, T[] b, int fromIndexB, int len) Finds and returns the index of the first mismatch between two arrays starting from specified indices.static <T> intmismatch(T[] a, int fromIndexA, T[] b, int fromIndexB, int len, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two arrays starting from specified indices.static <T extends Comparable<? super T>>
intmismatch(T[] a, T[] b) Finds and returns the index of the first mismatch between two arrays.static <T> intmismatch(T[] a, T[] b, Comparator<? super T> cmp) Finds and returns the index of the first mismatch between two arrays.static voidmoveRange(boolean[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static voidmoveRange(byte[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static voidmoveRange(char[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static voidmoveRange(double[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static voidmoveRange(float[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static voidmoveRange(int[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static voidmoveRange(long[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static voidmoveRange(short[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static StringReturns a new string with the specified range moved to the new position.static <T> booleanMoves a range of elements in the given list to a new position within the list.static <T> voidmoveRange(T[] a, int fromIndex, int toIndex, int newPositionStartIndex) Moves a range of elements in the given array to a new position within the array.static voidnegate(boolean[] a) Negates all elements in the specified boolean array.static voidnegate(boolean[] a, int fromIndex, int toIndex) Negates all elements in the specified range of the boolean array.static BooleanNote: copied from Apache commons Lang under Apache license v2.0static <T> TCreates a new array of the specified component type and length.static <T> TCreates a new array of the specified component type and dimensions.static <T> ArrayDeque<T> Creates a new instance of an ArrayDeque.static <T> ArrayDeque<T> newArrayDeque(int numElements) Creates a new instance of an ArrayDeque with the specified initial capacity.static <E> ArrayDeque<E> newArrayDeque(Collection<? extends E> c) Creates a new instance of an ArrayDeque with the elements from the specified collection.static <T> ArrayList<T> Creates a new instance of an ArrayList.static <T> ArrayList<T> newArrayList(int initialCapacity) Creates a new instance of an ArrayList with the specified initial capacity.static <T> ArrayList<T> newArrayList(Collection<? extends T> c) Creates a new instance of an ArrayList with the elements from the specified collection.static <T> TCreates a new instance of the specified bean class.static <K,V> BiMap <K, V> newBiMap()Creates a new instance of a BiMap.static <K,V> BiMap <K, V> newBiMap(int initialCapacity) Creates a new instance of a BiMap with the specified initial capacity.static <K,V> BiMap <K, V> newBiMap(int initialCapacity, float loadFactor) Creates a new instance of a BiMap with the specified initial capacity and load factor.static <K,V> BiMap <K, V> Creates a new instance of a BiMap with the specified key map type which is used to create map to store key/value pairs and value map type which is used to create map to store value/key pairs.static <K,V> BiMap <K, V> newBiMap(Supplier<? extends Map<K, V>> keyMapSupplier, Supplier<? extends Map<V, K>> valueMapSupplier) Creates a new instance of a BiMap with the specified key map supplier which provides the map to store key/value pairs and value map supplier which provides the map to store value/key pairs.static <T> Collection<T> newCollection(Class<? extends Collection> targetType) Creates a new collection of the specified type.static <T> Collection<T> newCollection(Class<? extends Collection> targetType, int size) Creates a new collection of the specified type with the given initial size.static <K,V> ConcurrentHashMap <K, V> Creates a new instance of a ConcurrentHashMap.static <K,V> ConcurrentHashMap <K, V> newConcurrentHashMap(int initialCapacity) Creates a new instance of a ConcurrentHashMap with the specified initial capacity.static <K,V> ConcurrentHashMap <K, V> newConcurrentHashMap(Map<? extends K, ? extends V> m) Creates a new instance of a ConcurrentHashMap with the entries from the specified map.static <T> Set<T> Creates a new instance of a concurrent hash set byConcurrentHashMap.static <T> Set<T> newConcurrentHashSet(int initialCapacity) Creates a new instance of a concurrent hash set with the specified initial capacity.static <T> Set<T> newConcurrentHashSet(Collection<? extends T> c) Creates a new instance of a concurrent hash set with the elements from the specified collection.static DataSetnewDataSet(String keyColumnName, String valueColumnName, Map<?, ?> m) Creates a new DataSet from the provided Map.static DataSetnewDataSet(String columnName, Collection<?> column) Creates a new DataSet with single column from the provided Collection.static DataSetnewDataSet(Collection<?> rows) Creates a new DataSet with the specified rows.static DataSetnewDataSet(Collection<?> rows, Map<String, Object> properties) Creates a new DataSet with the specified rows and properties.static DataSetnewDataSet(Collection<String> columnNames, Object[][] rowList) Creates a new DataSet with the specified column names and rows.static DataSetnewDataSet(Collection<String> columnNames, Collection<?> rows) Creates a new DataSet with the specified column names and rows.static DataSetnewDataSet(Collection<String> columnNames, Collection<?> rows, Map<String, Object> properties) Creates a new DataSet with the specified column names, rows, and properties.static <C extends Collection<?>>
DataSetnewDataSet(Map<String, C> map) Creates a new DataSet from the provided Map.static DataSetCreates a new empty DataSet.static DataSetnewEmptyDataSet(Collection<String> columnNames) Creates a new empty DataSet with the specified column names.static DataSetnewEmptyDataSet(Collection<String> columnNames, Map<String, Object> properties) Creates a new empty DataSet with the specified column names and properties.static <K,V> Map.Entry <K, V> newEntry(K key, V value) Creates a new entry with the specified key and value.static <K,V> Map <K, V> Creates a new instance of a HashMap.static <K,V> Map <K, V> newHashMap(int initialCapacity) Creates a new instance of a HashMap with the specified initial capacity.static <K,V> Map <K, V> newHashMap(Collection<? extends V> c, Function<? super V, ? extends K> keyExtractor) Creates a new instance of a HashMap with the elements from the specified collection.static <K,V> Map <K, V> newHashMap(Map<? extends K, ? extends V> m) Creates a new instance of a HashMap with the entries from the specified map.static <T> Set<T> Creates a new instance of a HashSet.static <T> Set<T> newHashSet(int initialCapacity) Creates a new instance of a HashSet with the specified initial capacity.static <T> Set<T> newHashSet(Collection<? extends T> c) Creates a new instance of a HashSet with the elements from the specified collection.static <K,V> IdentityHashMap <K, V> Creates a new instance of an IdentityHashMap.static <K,V> IdentityHashMap <K, V> newIdentityHashMap(int initialCapacity) Creates a new instance of an IdentityHashMap with the specified initial capacity.static <K,V> IdentityHashMap <K, V> newIdentityHashMap(Map<? extends K, ? extends V> m) Creates a new instance of an IdentityHashMap with the entries from the specified map.static <K,V> ImmutableEntry <K, V> newImmutableEntry(K key, V value) Creates a new immutable entry with the specified key and value.static <T> TnewInstance(Class<T> cls) Creates a new instance of the specified class.static <K,V> Map <K, V> Creates a new instance of a LinkedHashMap.static <K,V> Map <K, V> newLinkedHashMap(int initialCapacity) Creates a new instance of a LinkedHashMap with the specified initial capacity.static <K,V> Map <K, V> newLinkedHashMap(Collection<? extends V> c, Function<? super V, ? extends K> keyExtractor) Creates a new instance of a LinkedHashMap with the elements from the specified collection.static <K,V> Map <K, V> newLinkedHashMap(Map<? extends K, ? extends V> m) Creates a new instance of a LinkedHashMap with the entries from the specified map.static <T> Set<T> Creates a new instance of HashSet.static <T> Set<T> newLinkedHashSet(int initialCapacity) Creates a new instance of a LinkedHashSet with the specified initial capacity.static <T> Set<T> newLinkedHashSet(Collection<? extends T> c) Creates a new instance of a LinkedHashSet with the elements from the specified collection.static <T> LinkedList<T> Creates a new instance of a LinkedList.static <T> LinkedList<T> newLinkedList(Collection<? extends T> c) Creates a new instance of a LinkedList with the elements from the specified collection.static <K,E> ListMultimap <K, E> Creates a new instance of a ListMultimap backed by a LinkedHashMap.static <K,E> ListMultimap <K, E> newLinkedListMultimap(int initialCapacity) Creates a new instance of a ListMultimap backed by a LinkedHashMap with the specified initial capacity.static <K,E> ListMultimap <K, E> newLinkedListMultimap(Map<? extends K, ? extends E> m) Creates a new instance of a ListMultimap backed by a LinkedHashMap with the entries from the specified map.static <K,E> SetMultimap <K, E> Creates a new instance of a SetMultimap backed by a LinkedHashMap.static <K,E> SetMultimap <K, E> newLinkedSetMultimap(int initialCapacity) Creates a new instance of a SetMultimap backed by a LinkedHashMap with the specified initial capacity.static <K,E> SetMultimap <K, E> newLinkedSetMultimap(Map<? extends K, ? extends E> m) Creates a new instance of a SetMultimap backed by a LinkedHashMap with the entries from the specified map.static <K,E> ListMultimap <K, E> Creates a new instance of a ListMultimap.static <K,E> ListMultimap <K, E> newListMultimap(int initialCapacity) Creates a new instance of a ListMultimap with the specified initial capacity.static <K,E> ListMultimap <K, E> newListMultimap(Class<? extends Map> mapType) Creates a new instance of a ListMultimap with the specified map type which is used to create the backed map for storing entries.static <K,E> ListMultimap <K, E> newListMultimap(Class<? extends Map> mapType, Class<? extends List> valueType) Creates a new instance of a ListMultimap with the specified map type which is used to create the backed map for storing entries and value type which is used to create the backed list for storing values.static <T,K> ListMultimap <K, T> newListMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyExtractor) Creates a new instance of a ListMultimap with the keys extracted from the specified collection by the specifiedFunctionand values from the specified collection.static <T,K, E> ListMultimap <K, E> newListMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends E> valueExtractor) Creates a new instance of a ListMultimap with the keys and values extracted from the specified collection.static <K,E> ListMultimap <K, E> newListMultimap(Supplier<? extends Map<K, List<E>>> mapSupplier, Supplier<? extends List<E>> valueSupplier) Creates a new instance of a ListMultimap with the specified map and value suppliers.static <K,E> ListMultimap <K, E> newListMultimap(Map<? extends K, ? extends E> m) Creates a new instance of a ListMultimap with the entries from the specified map.static <K,V> Map <K, V> Creates a new map of the specified type.static <K,V> Map <K, V> Creates a new map of the specified type with the given initial size.static <K,E, V extends Collection<E>>
Multimap<K, E, V> newMultimap(Supplier<? extends Map<K, V>> mapSupplier, Supplier<? extends V> valueSupplier) Creates a new instance of a Multimap with the specified map which provides the map to store key/value pairs and value supplier which provides the collection to store values.static <T> Multiset<T> Creates a new instance of a Multiset.static <T> Multiset<T> newMultiset(int initialCapacity) Creates a new instance of a Multiset with the specified initial capacity.static <T> Multiset<T> newMultiset(Class<? extends Map> valueMapType) Creates a new instance of a Multiset with the specified backed Map type for storing element/occurrence pairs.static <T> Multiset<T> newMultiset(Collection<? extends T> c) Creates a new instance of a Multiset with the elements from the specified collection.static <T> Multiset<T> newMultiset(Supplier<? extends Map<T, ?>> mapSupplier) Creates a new instance of a Multiset with the specifiedSupplierwhich provides the map to store element/occurrence pairs.static <T> TnewProxyInstance(Class<?>[] interfaceClasses, InvocationHandler h) Creates a new proxy instance for the specified interfaces using the provided invocation handler.static <T> TnewProxyInstance(Class<T> interfaceClass, InvocationHandler h) Creates a new proxy instance for the specified interface using the provided invocation handler.static <E> Set<E> newSetFromMap(Map<E, Boolean> map) Returns a set backed by the specified map.static <K,E> SetMultimap <K, E> Creates a new instance of a SetMultimap.static <K,E> SetMultimap <K, E> newSetMultimap(int initialCapacity) Creates a new instance of a SetMultimap with the specified initial capacity.static <K,E> SetMultimap <K, E> newSetMultimap(Class<? extends Map> mapType) Creates a new instance of a SetMultimap with the specified map type which is used to create the backed map for storing entries.static <K,E> SetMultimap <K, E> newSetMultimap(Class<? extends Map> mapType, Class<? extends Set> valueType) Creates a new instance of a SetMultimap with the specified map type which is used to create the backed map for storing entries and value type which is used to create the backed Set for storing values.static <T,K> SetMultimap <K, T> newSetMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyExtractor) Creates a new instance of a SetMultimap with the keys extracted from the specified collection by the specifiedFunctionand values from the specified collection.static <T,K, E> SetMultimap <K, E> newSetMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends E> valueExtractor) Creates a new instance of a SetMultimap with the keys and values extracted from the specified collection.static <K,E> SetMultimap <K, E> newSetMultimap(Supplier<? extends Map<K, Set<E>>> mapSupplier, Supplier<? extends Set<E>> valueSupplier) Creates a new instance of a SetMultimap with the specified map and value suppliers.static <K,E> SetMultimap <K, E> newSetMultimap(Map<? extends K, ? extends E> m) Creates a new instance of a SetMultimap with the entries from the specified map.static <K extends Comparable<? super K>,E>
ListMultimap<K, E> Creates a new instance of a ListMultimap backed by a SortedMap.static <K extends Comparable<? super K>,E>
ListMultimap<K, E> newSortedListMultimap(Map<? extends K, ? extends E> m) Creates a new instance of a ListMultimap backed by a SortedMap with the entries from the specified map.static <K extends Comparable<? super K>,E>
SetMultimap<K, E> Creates a new instance of a SetMultimap backed by a SortedMap.static <K extends Comparable<? super K>,E>
SetMultimap<K, E> newSortedSetMultimap(Map<? extends K, ? extends E> m) Creates a new instance of a SetMultimap backed by a SortedMap with the entries from the specified map.static <K extends Comparable<? super K>,V>
TreeMap<K, V> Creates a new instance of a TreeMap.static <C,K extends C, V>
TreeMap<K, V> newTreeMap(Comparator<C> comparator) Creates a new instance of a TreeMap with the specified comparator.static <K extends Comparable<? super K>,V>
TreeMap<K, V> newTreeMap(Map<? extends K, ? extends V> m) Creates a new instance of a TreeMap with the entries from the specified map.static <K,V> TreeMap <K, V> newTreeMap(SortedMap<K, ? extends V> m) Creates a new instance of a TreeMap with the entries from the specified sorted map.static <T extends Comparable<? super T>>
TreeSet<T> Creates a new instance of TreeSet.static <T extends Comparable<? super T>>
TreeSet<T> newTreeSet(Collection<? extends T> c) Creates a new instance of a TreeSet with the elements from the specified collection.static <T> TreeSet<T> newTreeSet(Comparator<? super T> comparator) Creates a new instance of a TreeSet with the specified comparator.static <T> TreeSet<T> newTreeSet(SortedSet<T> c) Creates a new instance of a TreeSet with the elements from the specified sorted set.static <T> booleanChecks if the number of elements in the input iterable that match the given predicate is between the specified minimum and maximum values (inclusive).static <T> booleanChecks if the number of elements in the input iterator that match the given predicate is between the specified minimum and maximum values (inclusive).static <T> booleanChecks if the number of elements in the input array that match the given predicate is between the specified minimum and maximum values (inclusive).static <T> booleanChecks if none of the elements in the input iterable match the given predicate.static <T> booleanChecks if none of the elements in the input iterator match the given predicate.static <T> booleanChecks if none of the elements in the input array match the given predicate.static booleannotBlank(CharSequence cs) Checks if the specifiedCharSequenceis notnulland not empty and not contains only whitespace characters.static booleannotEmpty(boolean[] a) Checks if the specified boolean array is notnulland not empty.static booleannotEmpty(byte[] a) Checks if the specified byte array is notnulland not empty.static booleannotEmpty(char[] a) Checks if the specified char array is notnulland not empty.static booleannotEmpty(double[] a) Checks if the specified double array is notnulland not empty.static booleannotEmpty(float[] a) Checks if the specified float array is notnulland not empty.static booleannotEmpty(int[] a) Checks if the specified int array is notnulland not empty.static booleannotEmpty(long[] a) Checks if the specified long array is notnulland not empty.static booleannotEmpty(short[] a) Checks if the specified short array is notnulland not empty.static booleanChecks if the specifiedDataSetis notnulland not empty.static booleanChecks if the specifiedMultimapis notnulland not empty.static booleanChecks if the specifiedMultisetis notnulland not empty.static booleannotEmpty(PrimitiveList list) Checks if the specifiedPrimitiveListis notnulland not empty.static booleannotEmpty(CharSequence cs) Checks if the specifiedCharSequenceis notnulland not empty.static booleanChecks if the specified iterable is notnulland not empty.static booleanChecks if the specified object array is notnulland not empty.static booleannotEmpty(Collection<?> c) Checks if the specifiedCollectionis notnulland not empty.static booleanChecks if the specified iterator is notnulland not empty.static booleanChecks if the specifiedMapis notnulland not empty.static boolean[]nullToEmpty(boolean[] a) Returns an empty boolean array if the specified array isnull, otherwise returns the original array.static byte[]nullToEmpty(byte[] a) Returns an empty byte array if the specified array isnull, otherwise returns the original array.static char[]nullToEmpty(char[] a) Returns an empty char array if the specified array isnull, otherwise returns the original array.static double[]nullToEmpty(double[] a) Returns an empty double array if the specified array isnull, otherwise returns the original array.static float[]nullToEmpty(float[] a) Returns an empty float array if the specified array isnull, otherwise returns the original array.static int[]nullToEmpty(int[] a) Returns an empty int array if the specified array isnull, otherwise returns the original array.static long[]nullToEmpty(long[] a) Returns an empty long array if the specified array isnull, otherwise returns the original array.static short[]nullToEmpty(short[] a) Returns an empty short array if the specified array isnull, otherwise returns the original array.static <K,V> ImmutableBiMap <K, V> nullToEmpty(ImmutableBiMap<K, V> map) Returns an immutable/unmodifiable empty bi-map if the specified ImmutableBiMap isnull, otherwise returns the original bi-map.static <T> ImmutableCollection<T> Returns an immutable/unmodifiable empty Collection if the specified ImmutableCollection isnull, otherwise itself is returned.static <T> ImmutableList<T> nullToEmpty(ImmutableList<T> list) Returns an immutable/unmodifiable empty list if the specified ImmutableList isnull, otherwise returns the original list.static <K,V> ImmutableMap <K, V> nullToEmpty(ImmutableMap<K, V> map) Returns an immutable/unmodifiable empty map if the specified ImmutableMap isnull, otherwise returns the original map.static <K,V> ImmutableNavigableMap <K, V> nullToEmpty(ImmutableNavigableMap<K, V> map) Returns an immutable/unmodifiable empty navigable map if the specified ImmutableNavigableMap isnull, otherwise returns the original map.static <T> ImmutableNavigableSet<T> nullToEmpty(ImmutableNavigableSet<T> set) Returns an immutable/unmodifiable empty navigable set if the specified ImmutableNavigableSet isnull, otherwise returns the original set.static <T> ImmutableSet<T> nullToEmpty(ImmutableSet<T> set) Returns an immutable/unmodifiable empty set if the specified ImmutableSet isnull, otherwise returns the original set.static <K,V> ImmutableSortedMap <K, V> nullToEmpty(ImmutableSortedMap<K, V> map) Returns an immutable/unmodifiable empty sorted map if the specified ImmutableSortedMap isnull, otherwise returns the original map.static <T> ImmutableSortedSet<T> nullToEmpty(ImmutableSortedSet<T> set) Returns an immutable/unmodifiable empty sorted set if the specified ImmutableSortedSet isnull, otherwise returns the original set.static Object[]nullToEmpty(Object[] a) Returns an empty Object array if the specified array isnull, otherwise returns the original array.static StringnullToEmpty(String str) Converts anullstring to an empty string.static String[]nullToEmpty(String[] a) Returns an empty String array if the specified array isnull, otherwise returns the original array.static BigDecimal[]nullToEmpty(BigDecimal[] a) Returns an empty BigDecimal array if the specified array isnull, otherwise returns the original array.static BigInteger[]nullToEmpty(BigInteger[] a) Returns an empty BigInteger array if the specified array isnull, otherwise returns the original array.static Date[]nullToEmpty(Date[] a) Returns an empty Date array if the specified array isnull, otherwise returns the original array.static Time[]nullToEmpty(Time[] a) Returns an empty Time array if the specified array isnull, otherwise returns the original array.static Timestamp[]nullToEmpty(Timestamp[] a) Returns an empty Timestamp array if the specified array isnull, otherwise returns the original array.static Calendar[]nullToEmpty(Calendar[] a) Returns an empty Calendar array if the specified array isnull, otherwise returns the original array.static <T> Collection<T> nullToEmpty(Collection<T> c) Returns an immutable/unmodifiable emptyListif the specified list isnull, otherwise itself is returned.static Date[]nullToEmpty(Date[] a) Returns an empty Date array if the specified array isnull, otherwise returns the original array.static <T> Iterator<T> nullToEmpty(Iterator<T> iter) Returns an immutable/unmodifiable empty iterator if the specified Iterator isnull, otherwise itself is returned.static <T> List<T> nullToEmpty(List<T> list) Returns an immutable/unmodifiable empty list if the specified list isnull, otherwise itself is returned.static <T> ListIterator<T> nullToEmpty(ListIterator<T> iter) Returns an immutable/unmodifiable emptyListIteratorif the specified ListIterator isnull, otherwise itself is returned.static <K,V> Map <K, V> nullToEmpty(Map<K, V> map) Returns an immutable/unmodifiable empty map if the specified Map isnull, otherwise itself is returned.static <K,V> NavigableMap <K, V> nullToEmpty(NavigableMap<K, V> map) Returns an immutable/unmodifiable emptyNavigableMapif the specified NavigableMap isnull, otherwise itself is returned.static <T> NavigableSet<T> nullToEmpty(NavigableSet<T> set) Returns an immutable/unmodifiable emptyNavigableSetif the specified NavigableSet isnull, otherwise itself is returned.static <T> Set<T> nullToEmpty(Set<T> set) Returns an immutable/unmodifiable empty set if the specified Set isnull, otherwise itself is returned.static <K,V> SortedMap <K, V> nullToEmpty(SortedMap<K, V> map) Returns an immutable/unmodifiable emptySortedMapif the specified SortedMap isnull, otherwise itself is returned.static <T> SortedSet<T> nullToEmpty(SortedSet<T> set) Returns an immutable/unmodifiable emptySortedSetif the specified SortedSet isnull, otherwise itself is returned.static <T> T[]nullToEmpty(T[] a, Class<T[]> arrayType) Returns an empty array of the specified type if the given array isnull, otherwise returns the original array.static String[]nullToEmptyForEach(String[] a) Converts the specified String array to an emptyString[0]if it'snulland eachnullelement String to empty String"".occurrencesMap(Iterable<? extends T> c) Returns a map with the occurrences of each element in the given iterable collection.occurrencesMap(Iterable<? extends T> c, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given iterable collection.occurrencesMap(Iterator<? extends T> iter) Returns a map with the occurrences of each element in the given iterator.occurrencesMap(Iterator<? extends T> iter, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given iterator.occurrencesMap(T[] a) Returns a map with the occurrences of each element in the given array.occurrencesMap(T[] a, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given array.static intoccurrencesOf(boolean[] a, boolean valueToFind) Counts the occurrences of a specific boolean value in a boolean array.static intoccurrencesOf(byte[] a, byte valueToFind) Counts the occurrences of a specific byte value in a byte array.static intoccurrencesOf(char[] a, char valueToFind) Counts the occurrences of a specific char value in a char array.static intoccurrencesOf(double[] a, double valueToFind) Counts the occurrences of a specific double value in a double array.static intoccurrencesOf(float[] a, float valueToFind) Counts the occurrences of a specific float value in a float array.static intoccurrencesOf(int[] a, int valueToFind) Counts the occurrences of a specific int value in a int array.static intoccurrencesOf(long[] a, long valueToFind) Counts the occurrences of a specific long value in a long array.static intoccurrencesOf(short[] a, short valueToFind) Counts the occurrences of a specific short value in a short array.static intoccurrencesOf(Iterable<?> c, Object valueToFind) Counts the occurrences of a specific Object value in anIterable.static intoccurrencesOf(Object[] a, Object valueToFind) Counts the occurrences of a specific Object value in an Object array.static intoccurrencesOf(String str, char valueToFind) Counts the occurrences of a specific character in a String.static intoccurrencesOf(String str, String valueToFind) Counts the occurrences of a specific String value in another String.static intoccurrencesOf(Iterator<?> iter, Object valueToFind) Counts the occurrences of a specific Object value in anIterator.static <T> booleanAppends the provided object to the beginning of the list till the list has at least the specified minimum size.static <T> booleanpadRight(Collection<T> c, int minSize, T objToAdd) Appends the provided object to the end of the collection until the collection has at least the specified minimum size.static voidparallelSort(byte[] a) Sorts the specified array into ascending numerical order by multiple threads.static voidparallelSort(byte[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending numerical order by multiple threads.static voidparallelSort(char[] a) Sorts the specified array into ascending numerical order by multiple threads.static voidparallelSort(char[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending numerical order by multiple threads.static voidparallelSort(double[] a) Sorts the specified array into ascending numerical order by multiple threads.static voidparallelSort(double[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending numerical order by multiple threads.static voidparallelSort(float[] a) Sorts the specified array into ascending numerical order by multiple threads.static voidparallelSort(float[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending numerical order by multiple threads.static voidparallelSort(int[] a) Sorts the specified array into ascending numerical order by multiple threads.static voidparallelSort(int[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending numerical order by multiple threads.static voidparallelSort(long[] a) Sorts the specified array into ascending numerical order by multiple threads.static voidparallelSort(long[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending numerical order by multiple threads.static voidparallelSort(short[] a) Sorts the specified array into ascending numerical order by multiple threads.static voidparallelSort(short[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending numerical order by multiple threads.static <T extends Comparable<? super T>>
voidparallelSort(List<? extends T> list) Sorts the specified list according to the natural ordering (wherenullis minimum) by multiple threads.static <T extends Comparable<? super T>>
voidparallelSort(List<? extends T> list, int fromIndex, int toIndex) Sorts the specified range of the specified list according to the natural ordering (wherenullis minimum) by multiple threads.static <T> voidparallelSort(List<? extends T> list, int fromIndex, int toIndex, Comparator<? super T> cmp) Sorts the specified range of the list according to the order induced by the specified comparator by multiple threads.static <T> voidparallelSort(List<? extends T> list, Comparator<? super T> cmp) Sorts the specified list according to the order induced by the specified comparator by multiple threads.static <T extends Comparable<? super T>>
voidparallelSort(T[] a) Sorts the specified array according to the natural ordering (wherenullis minimum) by multiple threads.static <T extends Comparable<? super T>>
voidparallelSort(T[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array according to the natural ordering (wherenullis minimum) by multiple threads.static <T> voidparallelSort(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Sorts the specified range of the specified array according to the order induced by the specified comparator by multiple threads.static <T> voidparallelSort(T[] a, Comparator<? super T> cmp) Sorts the specified array according to the order induced by the specified comparator by multiple threads.static <T,U extends Comparable<? super U>>
voidparallelSortBy(List<? extends T> list, Function<? super T, ? extends U> keyExtractor) Sorts the specified list based on the keys extracted by the providedFunctionby multiple threads.static <T,U extends Comparable<? super U>>
voidparallelSortBy(T[] a, Function<? super T, ? extends U> keyExtractor) Sorts the specified array based on the keys extracted by the providedFunctionby multiple threads.static <T> voidparallelSortByDouble(List<? extends T> list, ToDoubleFunction<? super T> keyExtractor) Sorts the specified list based on the double values extracted by the providedToDoubleFunctionby multiple threads.static <T> voidparallelSortByDouble(T[] a, ToDoubleFunction<? super T> keyExtractor) Sorts the specified array based on the double values extracted by the providedToDoubleFunctionby multiple threads.static <T> voidparallelSortByFloat(List<? extends T> list, ToFloatFunction<? super T> keyExtractor) Sorts the specified list based on the float values extracted by the providedToFloatFunctionby multiple threads.static <T> voidparallelSortByFloat(T[] a, ToFloatFunction<? super T> keyExtractor) Sorts the specified array based on the float values extracted by the providedToFloatFunctionby multiple threads.static <T> voidparallelSortByInt(List<? extends T> list, ToIntFunction<? super T> keyExtractor) Sorts the specified list based on the int values extracted by the providedToIntFunctionby multiple threads.static <T> voidparallelSortByInt(T[] a, ToIntFunction<? super T> keyExtractor) Sorts the specified array based on the int values extracted by the providedToIntFunctionby multiple threads.static <T> voidparallelSortByLong(List<? extends T> list, ToLongFunction<? super T> keyExtractor) Sorts the specified list based on the long values extracted by the providedToLongFunctionby multiple threads.static <T> voidparallelSortByLong(T[] a, ToLongFunction<? super T> keyExtractor) Sorts the specified array based on the long values extracted by the providedToLongFunctionby multiple threads.static Map<Percentage, Byte> percentiles(byte[] sortedArray) Calculates the percentiles of the provided sorted array of bytes.static Map<Percentage, Character> percentiles(char[] sortedArray) Calculates the percentiles of the provided sorted array of characters.static Map<Percentage, Double> percentiles(double[] sortedArray) Calculates the percentiles of the provided sorted array of doubles.static Map<Percentage, Float> percentiles(float[] sortedArray) Calculates the percentiles of the provided sorted array of floats.static Map<Percentage, Integer> percentiles(int[] sortedArray) Calculates the percentiles of the provided sorted array of integers.static Map<Percentage, Long> percentiles(long[] sortedArray) Calculates the percentiles of the provided sorted array of longs.static Map<Percentage, Short> percentiles(short[] sortedArray) Calculates the percentiles of the provided sorted array of shorts.static <T> Map<Percentage, T> percentiles(List<T> sortedList) Calculates the percentiles of the provided sorted list.static <T> Map<Percentage, T> percentiles(T[] sortedArray) Calculates the percentiles of the provided sorted array.static <T> Tprintln(T obj) Prints the given object's string representation to the standard output stream (System.out) and returns the object.static booleanregisterConverter(Class<?> srcClass, BiFunction<?, Class<?>, ?> converter) Registers a converter for a specific source class.static boolean[]remove(boolean[] a, boolean valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static byte[]remove(byte[] a, byte valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static char[]remove(char[] a, char valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static double[]remove(double[] a, double valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static float[]remove(float[] a, float valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static int[]remove(int[] a, int valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static long[]remove(long[] a, long valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static short[]remove(short[] a, short valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static String[]Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static <T> booleanremove(Collection<T> c, T valueToRemove) Removes the first occurrence of the specified value from the given collection.static <T> T[]remove(T[] a, T valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.static boolean[]removeAll(boolean[] a, boolean... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static byte[]removeAll(byte[] a, byte... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static char[]removeAll(char[] a, char... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static double[]removeAll(double[] a, double... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static float[]removeAll(float[] a, float... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static int[]removeAll(int[] a, int... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static long[]removeAll(long[] a, long... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static short[]removeAll(short[] a, short... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static String[]Returns a new array with elements copied from the specified array except all occurrences of the specified values.static <T> booleanremoveAll(Collection<T> c, Iterable<?> valuesToRemove) Removes all occurrences of the specified values from the given collection.static <T> booleanremoveAll(Collection<T> c, Iterator<?> valuesToRemove) Removes all occurrences of the specified values from the given collection.static <T> booleanremoveAll(Collection<T> c, T... valuesToRemove) Removes all occurrences of the specified values from the given collection.static <T> T[]removeAll(T[] a, T... valuesToRemove) Returns a new array with elements copied from the specified array except all occurrences of the specified values.static boolean[]removeAllOccurrences(boolean[] a, boolean valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static byte[]removeAllOccurrences(byte[] a, byte valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static char[]removeAllOccurrences(char[] a, char valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static double[]removeAllOccurrences(double[] a, double valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static float[]removeAllOccurrences(float[] a, float valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static int[]removeAllOccurrences(int[] a, int valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static long[]removeAllOccurrences(long[] a, long valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static short[]removeAllOccurrences(short[] a, short valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static String[]removeAllOccurrences(String[] a, String valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static <T> booleanremoveAllOccurrences(Collection<T> c, T valueToRemove) Removes all occurrences of the specified value from the given collection.static <T> T[]removeAllOccurrences(T[] a, T valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.static boolean[]removeDuplicates(boolean[] a) Deprecated.Usedistinct(boolean[])instead.static byte[]removeDuplicates(byte[] a) Deprecated.Usedistinct(byte[])instead.static byte[]removeDuplicates(byte[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static byte[]removeDuplicates(byte[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static char[]removeDuplicates(char[] a) Deprecated.Usedistinct(char[])instead.static char[]removeDuplicates(char[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static char[]removeDuplicates(char[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static double[]removeDuplicates(double[] a) Deprecated.Usedistinct(double[])instead.static double[]removeDuplicates(double[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static double[]removeDuplicates(double[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static float[]removeDuplicates(float[] a) Deprecated.Usedistinct(float[])instead.static float[]removeDuplicates(float[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static float[]removeDuplicates(float[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static int[]removeDuplicates(int[] a) Deprecated.Usedistinct(int[])instead.static int[]removeDuplicates(int[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static int[]removeDuplicates(int[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static long[]removeDuplicates(long[] a) Deprecated.Usedistinct(long[])instead.static long[]removeDuplicates(long[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static long[]removeDuplicates(long[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static short[]removeDuplicates(short[] a) Deprecated.Usedistinct(short[])instead.static short[]removeDuplicates(short[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static short[]removeDuplicates(short[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static String[]removeDuplicates(String[] a) Returns a new array with elements from the input array but without any duplicates.static String[]removeDuplicates(String[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static String[]removeDuplicates(String[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static booleanremoveDuplicates(Collection<?> c) Removes duplicate elements from the given collection.static booleanremoveDuplicates(Collection<?> c, boolean isSorted) Removes duplicate elements from the given collection.static <T> T[]removeDuplicates(T[] a) Returns a new array with elements from the input array but without any duplicates.static <T> T[]removeDuplicates(T[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.static <T> T[]removeDuplicates(T[] a, int fromIndex, int toIndex, boolean isSorted) Returns a new array with distinct elements within the specified range.static <T> List<T> repeat(T value, int n) Repeats the provided value a specified number of times.static <T> List<T> repeatCollection(Collection<T> c, int n) Repeats the entire specified Collectionntimes.static <T> List<T> repeatCollectionToSize(Collection<? extends T> c, int size) Repeats the entire specified Collectionntimes till reach the specified size.static <T> List<T> repeatElements(Collection<? extends T> c, int n) Repeats each element in the specified Collection n times one by one.static <T> List<T> repeatElementsToSize(Collection<T> c, int size) Repeats each element in the specified Collection n times one by one till reach the specified size.static intreplaceAll(boolean[] a, boolean oldVal, boolean newVal) Replaces all occurrences of the specified old value with the new value in the given boolean array.static voidreplaceAll(boolean[] a, BooleanUnaryOperator operator) Replaces all elements in the given boolean array using the specifiedBooleanUnaryOperator.static intreplaceAll(byte[] a, byte oldVal, byte newVal) Replaces all occurrences of the specified old value with the new value in the given byte array.static voidreplaceAll(byte[] a, ByteUnaryOperator operator) Replaces all elements in the given byte array using the specifiedByteUnaryOperator.static intreplaceAll(char[] a, char oldVal, char newVal) Replaces all occurrences of the specified old value with the new value in the given char array.static voidreplaceAll(char[] a, CharUnaryOperator operator) Replaces all elements in the given char array using the specifiedCharUnaryOperator.static intreplaceAll(double[] a, double oldVal, double newVal) Replaces all occurrences of the specified old value with the new value in the given double array.static voidreplaceAll(double[] a, DoubleUnaryOperator operator) Replaces all elements in the given double array using the specifiedDoubleUnaryOperator.static intreplaceAll(float[] a, float oldVal, float newVal) Replaces all occurrences of the specified old value with the new value in the given float array.static voidreplaceAll(float[] a, FloatUnaryOperator operator) Replaces all elements in the given float array using the specifiedFloatUnaryOperator.static intreplaceAll(int[] a, int oldVal, int newVal) Replaces all occurrences of the specified old value with the new value in the given int array.static voidreplaceAll(int[] a, IntUnaryOperator operator) Replaces all elements in the given int array using the specifiedIntUnaryOperator.static intreplaceAll(long[] a, long oldVal, long newVal) Replaces all occurrences of the specified old value with the new value in the given long array.static voidreplaceAll(long[] a, LongUnaryOperator operator) Replaces all elements in the given long array using the specifiedLongUnaryOperator.static intreplaceAll(short[] a, short oldVal, short newVal) Replaces all occurrences of the specified old value with the new value in the given short array.static voidreplaceAll(short[] a, ShortUnaryOperator operator) Replaces all elements in the given short array using the specifiedShortUnaryOperator.static <T> intreplaceAll(List<T> list, Object oldVal, T newVal) Replaces all occurrences of the specified old value with the new value in the given list.static <T> voidreplaceAll(List<T> list, UnaryOperator<T> operator) Replaces all elements in the given list using the specifiedUnaryOperator.static <T> intreplaceAll(T[] a, Object oldVal, T newVal) Replaces all occurrences of the specified old value with the new value in the given array.static <T> voidreplaceAll(T[] a, UnaryOperator<T> operator) Replaces all elements in the given array using the specifiedUnaryOperator.static intreplaceIf(boolean[] a, BooleanPredicate predicate, boolean newValue) Replaces all elements in the given boolean array that satisfy the provided predicate with a specified boolean value.static intreplaceIf(byte[] a, BytePredicate predicate, byte newValue) Replaces all elements in the given byte array that satisfy the provided predicate with a specified byte value.static intreplaceIf(char[] a, CharPredicate predicate, char newValue) Replaces all elements in the given char array that satisfy the provided predicate with a specified char value.static intreplaceIf(double[] a, DoublePredicate predicate, double newValue) Replaces all elements in the given double array that satisfy the provided predicate with a specified double value.static intreplaceIf(float[] a, FloatPredicate predicate, float newValue) Replaces all elements in the given float array that satisfy the provided predicate with a specified float value.static intreplaceIf(int[] a, IntPredicate predicate, int newValue) Replaces all elements in the given int array that satisfy the provided predicate with a specified int value.static intreplaceIf(long[] a, LongPredicate predicate, long newValue) Replaces all elements in the given long array that satisfy the provided predicate with a specified long value.static intreplaceIf(short[] a, ShortPredicate predicate, short newValue) Replaces all elements in the given short array that satisfy the provided predicate with a specified short value.static <T> intReplaces all elements in the given list that satisfy the provided predicate with a specified value.static <T> intReplaces all elements in the given array that satisfy the provided predicate with a specified value.static boolean[]replaceRange(boolean[] a, int fromIndex, int toIndex, boolean[] replacement) Returns a new array with the specified range replaced with the replacement array.static byte[]replaceRange(byte[] a, int fromIndex, int toIndex, byte[] replacement) Returns a new array with the specified range replaced with the replacement array.static char[]replaceRange(char[] a, int fromIndex, int toIndex, char[] replacement) Returns a new array with the specified range replaced with the replacement array.static double[]replaceRange(double[] a, int fromIndex, int toIndex, double[] replacement) Returns a new array with the specified range replaced with the replacement array.static float[]replaceRange(float[] a, int fromIndex, int toIndex, float[] replacement) Returns a new array with the specified range replaced with the replacement array.static int[]replaceRange(int[] a, int fromIndex, int toIndex, int[] replacement) Returns a new array with the specified range replaced with the replacement array.static long[]replaceRange(long[] a, int fromIndex, int toIndex, long[] replacement) Returns a new array with the specified range replaced with the replacement array.static short[]replaceRange(short[] a, int fromIndex, int toIndex, short[] replacement) Returns a new array with the specified range replaced with the replacement array.static String[]replaceRange(String[] a, int fromIndex, int toIndex, String[] replacement) Returns a new array with the specified range replaced with the replacement array.static StringreplaceRange(String str, int fromIndex, int toIndex, String replacement) Returns a new String with the specified range replaced with the replacement String.static <T> booleanreplaceRange(List<T> c, int fromIndex, int toIndex, Collection<? extends T> replacement) Replaces a range of elements in the given list with the elements from the replacement collection.static <T> T[]replaceRange(T[] a, int fromIndex, int toIndex, T[] replacement) Returns a new array with the specified range replaced with the replacement array.static <T> TrequireNonNull(T obj) Checks if the specified object reference is notnull, and throwsNullPointerExceptionif it is.static <T> TrequireNonNull(T obj, String errorMessage) Checks if the specified object reference is notnull, and throwsNullPointerExceptionif it is.static <T> TrequireNonNull(T obj, Supplier<String> errorMessageSupplier) Checks if the specified object reference is notnull, and throwsNullPointerExceptionif it is.static <T> booleanretainAll(Collection<T> c, Collection<? extends T> objsToKeep) Retains only the elements in the specified collection that are present in the specified collection of elements to keep.static voidreverse(boolean[] a) Reverses the order of the elements in the specified boolean array.static voidreverse(boolean[] a, int fromIndex, int toIndex) Reverses the order of the elements in the specified range of the specified boolean array.static voidreverse(byte[] a) Reverses the order of the elements in the specified byte array.static voidreverse(byte[] a, int fromIndex, int toIndex) Reverses the order of the elements in the specified range of the specified byte array.static voidreverse(char[] a) Reverses the order of the elements in the specified char array.static voidreverse(char[] a, int fromIndex, int toIndex) Reverses the order of the elements in the specified range of the specified char array.static voidreverse(double[] a) Reverses the order of the elements in the specified double array.static voidreverse(double[] a, int fromIndex, int toIndex) Reverses the order of the elements in the specified range of the specified double array.static voidreverse(float[] a) Reverses the order of the elements in the specified float array.static voidreverse(float[] a, int fromIndex, int toIndex) Reverses the order of the elements in the specified range of the specified float array.static voidreverse(int[] a) Reverses the order of the elements in the specified int array.static voidreverse(int[] a, int fromIndex, int toIndex) Reverses the order of the elements in the specified range of the specified int array.static voidreverse(long[] a) Reverses the order of the elements in the specified long array.static voidreverse(long[] a, int fromIndex, int toIndex) Reverses the order of the elements in the specified range of the specified long array.static voidreverse(short[] a) Reverses the order of the elements in the specified short array.static voidreverse(short[] a, int fromIndex, int toIndex) Reverses the order of the elements in the specified range of the specified short array.static voidReverses the order of the elements in the specified object array.static voidReverses the order of the elements in the specified range of the specified object array.static voidreverse(Collection<?> c) Reverses the order of the elements in the specified collection that has a well-defined encounter order.static voidReverses the order of the elements in the specified list.static voidReverses the order of the elements in the specified range of the specified list.static voidreverseSort(boolean[] a) Sorts the specified array of booleans in reverse order.static voidreverseSort(boolean[] a, int fromIndex, int toIndex) Sorts the specified range of the array of booleans in reverse order.static voidreverseSort(byte[] a) Sorts the specified array of bytes in reverse order.static voidreverseSort(byte[] a, int fromIndex, int toIndex) Sorts the specified range of the array of bytes in reverse order.static voidreverseSort(char[] a) Sorts the specified array of characters in reverse order.static voidreverseSort(char[] a, int fromIndex, int toIndex) Sorts the specified range of the array of characters in reverse order.static voidreverseSort(double[] a) Sorts the specified array of doubles in reverse order.static voidreverseSort(double[] a, int fromIndex, int toIndex) Sorts the specified range of the array of doubles in reverse order.static voidreverseSort(float[] a) Sorts the specified array of floats in reverse order.static voidreverseSort(float[] a, int fromIndex, int toIndex) Sorts the specified range of the array of floats in reverse order.static voidreverseSort(int[] a) Sorts the specified array of ints in reverse order.static voidreverseSort(int[] a, int fromIndex, int toIndex) Sorts the specified range of the array of ints in reverse order.static voidreverseSort(long[] a) Sorts the specified array of longs in reverse order.static voidreverseSort(long[] a, int fromIndex, int toIndex) Sorts the specified range of the array of longs in reverse order.static voidreverseSort(short[] a) Sorts the specified array of shorts in reverse order.static voidreverseSort(short[] a, int fromIndex, int toIndex) Sorts the specified range of the array of shorts in reverse order.static voidreverseSort(Object[] a) Sorts the specified array of objects in reverse order.static voidreverseSort(Object[] a, int fromIndex, int toIndex) Sorts the specified range of the array of objects in reverse order.static <T extends Comparable<? super T>>
voidreverseSort(List<? extends T> list) Sorts the specified list in reverse order.static <T extends Comparable<? super T>>
voidreverseSort(List<? extends T> list, int fromIndex, int toIndex) Sorts the specified range of the list in reverse order.static <T,U extends Comparable<? super U>>
voidreverseSortBy(List<? extends T> list, Function<? super T, ? extends U> keyExtractor) Sorts the specified list based on the keys extracted by the providedFunctionin reverse order.static <T,U extends Comparable<? super U>>
voidreverseSortBy(T[] a, Function<? super T, ? extends U> keyExtractor) Sorts the specified array based on the keys extracted by the providedFunctionin reverse order.static <T> voidreverseSortByDouble(List<? extends T> list, ToDoubleFunction<? super T> keyExtractor) Sorts the specified list based on the double values extracted by the providedToDoubleFunctionin reverse order.static <T> voidreverseSortByDouble(T[] a, ToDoubleFunction<? super T> keyExtractor) Sorts the specified array based on the double values extracted by the providedToDoubleFunctionin reverse order.static <T> voidreverseSortByFloat(List<? extends T> list, ToFloatFunction<? super T> keyExtractor) Sorts the specified list based on the float values extracted by the providedToFloatFunctionin reverse order.static <T> voidreverseSortByFloat(T[] a, ToFloatFunction<? super T> keyExtractor) Sorts the specified array based on the float values extracted by the providedToFloatFunctionin reverse order.static <T> voidreverseSortByInt(List<? extends T> list, ToIntFunction<? super T> keyExtractor) Sorts the specified list based on the int values extracted by the providedToIntFunctionin reverse order.static <T> voidreverseSortByInt(T[] a, ToIntFunction<? super T> keyExtractor) Sorts the specified array based on the int values extracted by the providedToIntFunctionin reverse order.static <T> voidreverseSortByLong(List<? extends T> list, ToLongFunction<? super T> keyExtractor) Sorts the specified list based on the long values extracted by the providedToLongFunctionin reverse order.static <T> voidreverseSortByLong(T[] a, ToLongFunction<? super T> keyExtractor) Sorts the specified array based on the long values extracted by the providedToLongFunctionin reverse order.static <T> List<T> reverseToList(Collection<? extends T> c) Returns a new list with the elements from the specified collection in reverse order.static voidrotate(boolean[] a, int distance) Rotates the elements of the specified boolean array by the specified distance.static voidrotate(byte[] a, int distance) Rotates the elements of the specified byte array by the specified distance.static voidrotate(char[] a, int distance) Rotates the elements of the specified char array by the specified distance.static voidrotate(double[] a, int distance) Rotates the elements of the specified double array by the specified distance.static voidrotate(float[] a, int distance) Rotates the elements of the specified float array by the specified distance.static voidrotate(int[] a, int distance) Rotates the elements of the specified int array by the specified distance.static voidrotate(long[] a, int distance) Rotates the elements of the specified long array by the specified distance.static voidrotate(short[] a, int distance) Rotates the elements of the specified short array by the specified distance.static voidRotates the elements of the specified Object array by the specified distance.static voidrotate(Collection<?> c, int distance) Rotates the elements of the specified collection that has a well-defined encounter order by the specified distance.static voidRotates the elements of the specified list by the specified distance.static <T,E extends Exception>
voidrunByBatch(Iterable<? extends T> iter, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) Executes the given action on batches of elements from the provided iterable.runByBatch(Iterable<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index for preparing batch execution.static <T,E extends Exception>
voidrunByBatch(Iterator<? extends T> iter, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) Executes the given action on batches of elements from the provided iterator.runByBatch(Iterator<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index for preparing batch execution.static <T,E extends Exception>
voidrunByBatch(T[] a, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) Executes the given action on batches of elements from the provided array.runByBatch(T[] a, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index for preparing batch execution.static voidrunInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2) Executes and completes the input commands in parallel.static voidrunInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3) Executes and complete the input commands in parallel.static voidrunInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3, Throwables.Runnable<? extends Exception> command4) Executes and complete the input commands in parallel.static voidrunInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3, Throwables.Runnable<? extends Exception> command4, Throwables.Runnable<? extends Exception> command5) Executes and complete the input commands in parallel.static voidrunInParallel(Collection<? extends Throwables.Runnable<? extends Exception>> commands) Executes the specified collection of commands/tasks in parallel.static voidrunInParallel(Collection<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) Executes and complete the input commands in parallel.static voidrunUninterruptibly(Throwables.BiConsumer<Long, TimeUnit, InterruptedException> cmd, long timeout, TimeUnit unit) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static voidrunUninterruptibly(Throwables.LongConsumer<InterruptedException> cmd, long timeoutInMillis) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static voidNote: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static voidsetAll(boolean[] array, IntToBooleanFunction generator) Sets all elements in the given array using the provided generator function.static voidsetAll(byte[] array, IntToByteFunction generator) Sets all elements in the given array using the provided generator function.static voidsetAll(char[] array, IntToCharFunction generator) Sets all elements in the given array using the provided generator function.static voidsetAll(double[] array, IntToDoubleFunction generator) Sets all elements in the given array using the provided generator function.static voidsetAll(float[] array, IntToFloatFunction generator) Sets all elements in the given array using the provided generator function.static voidsetAll(int[] array, IntUnaryOperator generator) Sets all elements in the given array using the provided generator function.static voidsetAll(long[] array, IntToLongFunction generator) Sets all elements in the given array using the provided generator function.static voidsetAll(short[] array, IntToShortFunction generator) Sets all elements in the given array using the provided generator function.static <T,E extends Exception>
voidsetAll(List<T> list, Throwables.IntObjFunction<? super T, ? extends T, E> converter) Sets all elements in the given list using the provided converter function.static <T> voidsetAll(List<T> list, IntFunction<? extends T> generator) Sets all elements in the given list using the provided generator function.static <T,E extends Exception>
voidsetAll(T[] a, Throwables.IntObjFunction<? super T, ? extends T, E> converter) Sets all elements in the given array using the provided converter function.static <T> voidsetAll(T[] array, IntFunction<? extends T> generator) Sets all elements in the given array using the provided generator function.static voidsetPropValue(Object bean, String propName, Object propValue) Deprecated.static voidshuffle(boolean[] a) Shuffles the elements of the specified boolean array.static voidShuffles the elements of the specified boolean array using the specified random number generator.static voidshuffle(byte[] a) Shuffles the elements of the specified byte array.static voidShuffles the elements of the specified byte array using the specified random number generator.static voidshuffle(char[] a) Shuffles the elements of the specified char array.static voidShuffles the elements of the specified char array using the specified random number generator.static voidshuffle(double[] a) Shuffles the elements of the specified double array.static voidShuffles the elements of the specified double array using the specified random number generator.static voidshuffle(float[] a) Shuffles the elements of the specified float array.static voidShuffles the elements of the specified float array using the specified random number generator.static voidshuffle(int[] a) Shuffles the elements of the specified int array.static voidShuffles the elements of the specified int array using the specified random number generator.static voidshuffle(long[] a) Shuffles the elements of the specified long array.static voidShuffles the elements of the specified long array using the specified random number generator.static voidshuffle(short[] a) Shuffles the elements of the specified short array.static voidShuffles the elements of the specified short array using the specified random number generator.static voidShuffles the elements of the specified object array.static voidShuffles the elements of the specified object array using the specified random number generator.static voidshuffle(Collection<?> c) Shuffles the elements of the specified collection that has a well-defined encounter order.static voidshuffle(Collection<?> c, Random rnd) Shuffles the elements of the specified collection that has a well-defined encounter order using the specified random number generator.static voidShuffles the elements of the specified list.static voidShuffles the elements of the specified list using the specified random number generator.static intReturns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intsize(Collection<?> c) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static intReturns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.static <T> List<T> skipRange(Collection<? extends T> c, int startInclusive, int endExclusive) Returns a new list with the specified range skipped.static <T,C extends Collection<T>>
CskipRange(Collection<? extends T> c, int startInclusive, int endExclusive, IntFunction<C> supplier) Returns a new collection with the specified range skipped.static <T> T[]skipRange(T[] a, int startInclusive, int endExclusive) Returns a new array with the specified range skipped.static <T> List<T> Returns a list containing the elements of the input iterable starting from the first element that satisfies the provided predicate.static <T> List<T> Returns a list containing the elements of the input iterator starting from the first element that satisfies the provided predicate.static <T> List<T> Returns a list containing the elements of the input array starting from the first element that satisfies the provided predicate.static voidsleep(long timeoutInMillis) Pauses the execution of the current thread for a specified time.static voidPauses the execution of the current thread for a specified time.static voidsleepUninterruptibly(long timeoutInMillis) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static voidsleepUninterruptibly(long timeout, TimeUnit unit) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.static <T> ImmutableCollection<T> slice(Collection<? extends T> c, int fromIndex, int toIndex) Returns a read-only slice of the input collection from the specified start index to the end index.static <T> ObjIterator<T> Returns a read-only slice of the input iterator from the specified start index to the end index.static <T> ImmutableList<T> Returns a read-only slice of the input list from the specified start index to the end index.static <T> ImmutableList<T> slice(T[] a, int fromIndex, int toIndex) Returns a read-only slice of the input array from the specified start index to the end index.static voidsort(boolean[] a) Sorts the specified array of booleans into ascending order.static voidsort(boolean[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending order.static voidsort(byte[] a) Sorts the specified array into ascending numerical order.static voidsort(byte[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending order.static voidsort(char[] a) Sorts the specified array into ascending order.static voidsort(char[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending order.static voidsort(double[] a) Sorts the specified array into ascending order.static voidsort(double[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending order.static voidsort(float[] a) Sorts the specified array into ascending numerical order.static voidsort(float[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending order.static voidsort(int[] a) Sorts the specified array into ascending numerical order.static voidsort(int[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending order.static voidsort(long[] a) Sorts the specified array into ascending numerical order.static voidsort(long[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending order.static voidsort(short[] a) Sorts the specified array into ascending numerical order.static voidsort(short[] a, int fromIndex, int toIndex) Sorts the specified range of the array into ascending order.static voidSorts the specified array according to the natural ordering (wherenullis smallest).static voidSorts the specified range of the specified array according to the natural ordering (wherenullis smallest).static <T extends Comparable<? super T>>
voidSorts the specified list according to the natural ordering (wherenullis smallest).static <T extends Comparable<? super T>>
voidSorts the specified range of the specified list according to the natural ordering (wherenullis smallest).static <T> voidsort(List<? extends T> list, int fromIndex, int toIndex, Comparator<? super T> cmp) Sorts the specified range of the list according to the order induced by the specified comparator.static <T> voidsort(List<? extends T> list, Comparator<? super T> cmp) Sorts the specified list according to the order induced by the specified comparator.static <T> voidsort(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) Sorts the specified range of the specified array according to the order induced by the specified comparator.static <T> voidsort(T[] a, Comparator<? super T> cmp) Sorts the specified array according to the order induced by the specified comparator.static <T,U extends Comparable<? super U>>
voidSorts the specified list based on the keys extracted by the providedFunction.static <T,U extends Comparable<? super U>>
voidSorts the specified array based on the keys extracted by the providedFunction.static <T> voidsortByDouble(List<? extends T> list, ToDoubleFunction<? super T> keyExtractor) Sorts the specified list into ascending numerical order based on the keys extracted by the providedToDoubleFunction.static <T> voidsortByDouble(T[] a, ToDoubleFunction<? super T> keyExtractor) Sorts the specified array into ascending numerical order based on the keys extracted by the providedToDoubleFunction.static <T> voidsortByFloat(List<? extends T> list, ToFloatFunction<? super T> keyExtractor) Sorts the specified list into ascending numerical order based on the keys extracted by the providedToFloatFunction.static <T> voidsortByFloat(T[] a, ToFloatFunction<? super T> keyExtractor) Sorts the specified array into ascending numerical order based on the keys extracted by the providedToFloatFunction.static <T> voidsortByInt(List<? extends T> list, ToIntFunction<? super T> keyExtractor) Sorts the specified list into ascending numerical order based on the keys extracted by the providedToIntFunction.static <T> voidsortByInt(T[] a, ToIntFunction<? super T> keyExtractor) Sorts the specified array into ascending numerical order based on the keys extracted by the providedToIntFunction.static <T> voidsortByLong(List<? extends T> list, ToLongFunction<? super T> keyExtractor) Sorts the specified list into ascending numerical order based on the keys extracted by the providedToLongFunction.static <T> voidsortByLong(T[] a, ToLongFunction<? super T> keyExtractor) Sorts the specified array into ascending numerical order based on the keys extracted by the providedToLongFunction.static List<boolean[]> split(boolean[] a, int chunkSize) Splits the input boolean array into sub-arrays of the specified size.static List<boolean[]> split(boolean[] a, int fromIndex, int toIndex, int chunkSize) Splits the input boolean array into sub-arrays of the specified size.static List<byte[]> split(byte[] a, int chunkSize) Splits the input byte array into sub-arrays of the specified size.static List<byte[]> split(byte[] a, int fromIndex, int toIndex, int chunkSize) Splits the input byte array into sub-arrays of the specified size.static List<char[]> split(char[] a, int chunkSize) Splits the input char array into sub-arrays of the specified size.static List<char[]> split(char[] a, int fromIndex, int toIndex, int chunkSize) Splits the input char array into sub-arrays of the specified size.static List<double[]> split(double[] a, int chunkSize) Splits the input double array into sub-arrays of the specified size.static List<double[]> split(double[] a, int fromIndex, int toIndex, int chunkSize) Splits the input double array into sub-arrays of the specified size.static List<float[]> split(float[] a, int chunkSize) Splits the input float array into sub-arrays of the specified size.static List<float[]> split(float[] a, int fromIndex, int toIndex, int chunkSize) Splits the input float array into sub-arrays of the specified size.static List<int[]> split(int[] a, int chunkSize) Splits the input int array into sub-arrays of the specified size.static List<int[]> split(int[] a, int fromIndex, int toIndex, int chunkSize) Splits the input int array into sub-arrays of the specified size.static List<long[]> split(long[] a, int chunkSize) Splits the input long array into sub-arrays of the specified size.static List<long[]> split(long[] a, int fromIndex, int toIndex, int chunkSize) Splits the input long array into sub-arrays of the specified size.static List<short[]> split(short[] a, int chunkSize) Splits the input short array into sub-arrays of the specified size.static List<short[]> split(short[] a, int fromIndex, int toIndex, int chunkSize) Splits the input short array into sub-arrays of the specified size.split(CharSequence str, int chunkSize) Returns consecutive substring of the specified string, each of the same length (the final list may be smaller), or an empty array if the specified string isnullor empty.split(CharSequence str, int fromIndex, int toIndex, int chunkSize) Returns consecutive substring of the specified string, each of the same length (the final list may be smaller), or an empty array if the specified string isnullor empty.Splits the input iterable into sub-collections of the specified size.split(Collection<? extends T> c, int chunkSize) Splits the input collection into sub-collections of the specified size.split(Collection<? extends T> c, int fromIndex, int toIndex, int chunkSize) Splits the input collection into sub-collections of the specified size.static <T> ObjIterator<List<T>> Splits the input iterator into sub-collections of the specified size.static <T> List<T[]> split(T[] a, int chunkSize) Splits the input array into sub-arrays of the specified size.static <T> List<T[]> split(T[] a, int fromIndex, int toIndex, int chunkSize) Splits the input array into sub-arrays of the specified size.static <T> List<T> splitByChunkCount(int totalSize, int maxChunkCount, boolean sizeSmallerFirst, IntBiFunction<? extends T> func) Splits the total size into chunks based on the specified maximum chunk count.static <T> List<T> splitByChunkCount(int totalSize, int maxChunkCount, IntBiFunction<? extends T> func) Splits the total size into chunks based on the specified maximum chunk count.splitByChunkCount(Collection<? extends T> c, int maxChunkCount) Splits the input collection into sub-lists based on the specified maximum chunk count.splitByChunkCount(Collection<? extends T> c, int maxChunkCount, boolean sizeSmallerFirst) Splits the input collection into sub-lists based on the specified maximum chunk count.static <T> Stream<T> streamJson(File jsonArray, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified file with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(File jsonArray, JSONDeserializationConfig config, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified file with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(File jsonArray, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified file with the specified target type.static <T> Stream<T> streamJson(File jsonArray, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified file with the specified target type.static <T> Stream<T> streamJson(InputStream jsonArray, boolean closeInputStreamWhenStreamIsClosed, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(InputStream jsonArray, boolean closeInputStreamWhenStreamIsClosed, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(InputStream jsonArray, JSONDeserializationConfig config, boolean closeInputStreamWhenStreamIsClosed, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(InputStream jsonArray, JSONDeserializationConfig config, boolean closeInputStreamWhenStreamIsClosed, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(InputStream jsonArray, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type.static <T> Stream<T> streamJson(InputStream jsonArray, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type.static <T> Stream<T> streamJson(Reader jsonArray, boolean closeReaderWhenStreamIsClosed, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(Reader jsonArray, boolean closeReaderWhenStreamIsClosed, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(Reader jsonArray, JSONDeserializationConfig config, boolean closeReaderWhenStreamIsClosed, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(Reader jsonArray, JSONDeserializationConfig config, boolean closeReaderWhenStreamIsClosed, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(Reader jsonArray, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type.static <T> Stream<T> streamJson(Reader jsonArray, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type.static <T> Stream<T> streamJson(String jsonArray, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array string with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(String jsonArray, JSONDeserializationConfig config, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array string with the specified target type andJSONDeserializationConfig.static <T> Stream<T> streamJson(String jsonArray, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array string with the specified target type.static <T> Stream<T> streamJson(String jsonArray, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array string with the specified target type.static StringstringOf(boolean val) Converts the given value to its corresponding String representation.static StringstringOf(byte val) Converts the given value to its corresponding String representation.static StringstringOf(char val) Converts the given value to its corresponding String representation.static StringstringOf(double val) Converts the given value to its corresponding String representation.static StringstringOf(float val) Converts the given value to its corresponding String representation.static StringstringOf(int val) Converts the given value to its corresponding String representation.static StringstringOf(long val) Converts the given value to its corresponding String representation.static StringstringOf(short val) Converts the given value to its corresponding String representation.static StringConverts the given value to its corresponding String representation byType.stringOf(Object).static intsum(byte... a) Sums all elements in the given array of bytes.static intsum(byte[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of bytesstatic intsum(char... a) Sums all elements in the given array of characters.static intsum(char[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of charactersstatic doublesum(double... a) Sums all elements in the given array of doubles.static doublesum(double[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of doublesstatic floatsum(float... a) Sums all elements in the given array of floats.static floatsum(float[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of floatsstatic intsum(int... a) Sums all elements in the given array of ints.static intsum(int[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of intsstatic longsum(long... a) Sums all elements in the given array of longs.static longsum(long[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of longsstatic intsum(short... a) Sums all elements in the given array of shorts.static intsum(short[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of shortsstatic BigDecimalsumBigDecimal(Iterable<? extends BigDecimal> c) Sums all elements in the given iterable of BigDecimal and returns the result as a BigDecimal.static <T> BigDecimalsumBigDecimal(Iterable<? extends T> c, Function<? super T, BigDecimal> func) Sums all elements in the given iterable using the provided function to convert each element to a BigDecimal.static BigIntegersumBigInteger(Iterable<? extends BigInteger> c) Sums all elements in the given iterable of BigInteger and returns the result as a BigInteger.static <T> BigIntegersumBigInteger(Iterable<? extends T> c, Function<? super T, BigInteger> func) Sums all elements in the given iterable using the provided function to convert each element to a BigInteger.static <T extends Number>
doubleSums all elements in the given iterable of numbers and returns the result as a double.static <T> doublesumDouble(Iterable<? extends T> c, ToDoubleFunction<? super T> func) Sums all elements in the given iterable using the provided function to convert each element to a double.static <T extends Number>
doublesumDouble(Collection<? extends T> c, int fromIndex, int toIndex) Sums all elements within the specified range in the input collection of numbers and returns the result as an double.static <T> doublesumDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) Sums all elements within the specified range in the input collection using the provided function to convert each element to a double.static <T extends Number>
doublesumDouble(T[] a) Sums all elements in the given array of numbers and returns the result as a double.static <T extends Number>
doublesumDouble(T[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of numbers and returns the result as a double.static <T> doublesumDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) Sums all elements within the specified range in the input array using the provided function to convert each element to a double.static <T> doublesumDouble(T[] a, ToDoubleFunction<? super T> func) Sums all elements in the given array using the provided function to convert each element to a double.static <T extends Number>
intSums all elements in the given iterable of numbers and returns the result as a integer.static <T> intsumInt(Iterable<? extends T> c, ToIntFunction<? super T> func) Sums all elements in the given iterable using the provided function to convert each element to an integer.static <T extends Number>
intsumInt(Collection<? extends T> c, int fromIndex, int toIndex) Sums all elements within the specified range in the input collection of numbers and returns the result as an integer.static <T> intsumInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> func) Sums all elements within the specified range in the input collection using the provided function to convert each element to an integer.static <T extends Number>
intsumInt(T[] a) Sums all elements in the given array of numbers and returns the result as an integer.static <T extends Number>
intsumInt(T[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of numbers and returns the result as an integer.static <T> intsumInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> func) Sums all elements within the specified range in the input array using the provided function to convert each element to an integer.static <T> intsumInt(T[] a, ToIntFunction<? super T> func) Sums all elements in the given array using the provided function to convert each element to an integer.static <T extends Number>
longsumIntToLong(Iterable<? extends T> c) Sums all elements in the given iterable of numbers and returns the result as a long.static <T> longsumIntToLong(Iterable<? extends T> c, ToIntFunction<? super T> func) Sums all elements in the given iterable using the provided function to convert each element to an integer and returns the result as a long.static <T extends Number>
longSums all elements in the given iterable of numbers and returns the result as a long.static <T> longsumLong(Iterable<? extends T> c, ToLongFunction<? super T> func) Sums all elements in the given iterable using the provided function to convert each element to a long.static <T extends Number>
longsumLong(Collection<? extends T> c, int fromIndex, int toIndex) Sums all elements within the specified range in the input collection of numbers and returns the result as an long.static <T> longsumLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> func) Sums all elements within the specified range in the input collection using the provided function to convert each element to a long.static <T extends Number>
longsumLong(T[] a) Sums all elements in the given array of numbers and returns the result as a long.static <T extends Number>
longsumLong(T[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of numbers and returns the result as a long.static <T> longsumLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> func) Sums all elements within the specified range in the input array using the provided function to convert each element to a long.static <T> longsumLong(T[] a, ToLongFunction<? super T> func) Sums all elements in the given array using the provided function to convert each element to a long.static doublesumToDouble(float... a) Sums all elements in the given array of floats to a double value.static doublesumToDouble(float[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of floats to a double value.static longsumToLong(int... a) Sums all elements in the given array of ints to a long value.static longsumToLong(int[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of ints to a long value.static voidswap(boolean[] a, int i, int j) Swaps the elements at the specified positions in the specified boolean array.static voidswap(byte[] a, int i, int j) Swaps the elements at the specified positions in the specified byte array.static voidswap(char[] a, int i, int j) Swaps the elements at the specified positions in the specified char array.static voidswap(double[] a, int i, int j) Swaps the elements at the specified positions in the specified double array.static voidswap(float[] a, int i, int j) Swaps the elements at the specified positions in the specified float array.static voidswap(int[] a, int i, int j) Swaps the elements at the specified positions in the specified int array.static voidswap(long[] a, int i, int j) Swaps the elements at the specified positions in the specified long array.static voidswap(short[] a, int i, int j) Swaps the elements at the specified positions in the specified short array.static <T> voidSwaps the left and right elements in the specified pair.static <T,M> void Swaps the left and right elements in the specified triple.static voidSwaps the elements at the specified positions in the specified Object array.static voidSwaps the elements at the specified positions in the specified list.static <T> booleanSwaps the left and right elements in the specified pair if the specified predicate istrue.static <T,M> boolean Swaps the left and right elements in the specified triple if the specified predicate istrue.static boolean[]symmetricDifference(boolean[] a, boolean[] b) Returns the elements that are present in either a or b but not in both.static byte[]symmetricDifference(byte[] a, byte[] b) Returns the elements that are present in either a or b but not in both.static char[]symmetricDifference(char[] a, char[] b) Returns the elements that are present in either a or b but not in both.static double[]symmetricDifference(double[] a, double[] b) Returns the elements that are present in either a or b but not in both.static float[]symmetricDifference(float[] a, float[] b) Returns the elements that are present in either a or b but not in both.static int[]symmetricDifference(int[] a, int[] b) Returns the elements that are present in either a or b but not in both.static long[]symmetricDifference(long[] a, long[] b) Returns the elements that are present in either a or b but not in both.static short[]symmetricDifference(short[] a, short[] b) Returns the elements that are present in either a or b but not in both.static <T> List<T> symmetricDifference(Collection<? extends T> a, Collection<? extends T> b) Returns the elements that are present in either a or b but not in both.static <T> List<T> symmetricDifference(T[] a, T[] b) Returns the elements that are present in either a or b but not in both.static <T> List<T> Returns a list containing the elements of the input iterable until the provided predicate returnsfalse.static <T> List<T> Returns a list containing the elements of the input iterator until the provided predicate returnsfalse.static <T> List<T> Returns a list containing the elements of the input array until the provided predicate returnsfalse.static <T> List<T> takeWhileInclusive(Iterable<? extends T> c, Predicate<? super T> filter) Returns a list containing the elements of the input iterable until the provided predicate returnsfalse, including the element that fails the predicate.static <T> List<T> takeWhileInclusive(Iterator<? extends T> iter, Predicate<? super T> filter) Returns a list containing the elements of the input iterator until the provided predicate returnsfalse, including the element that fails the predicate.static <T> List<T> takeWhileInclusive(T[] a, Predicate<? super T> filter) Returns a list containing the elements of the input array until the provided predicate returnsfalse, including the element that fails the predicate.static Object[]toArray(Collection<?> c) Converts the specified collection to an array.static Object[]toArray(Collection<?> c, int fromIndex, int toIndex) Converts the specified range in the specified collection into an array.static <A,T extends A>
A[]toArray(Collection<? extends T> c, int fromIndex, int toIndex, A[] a) Converts the specified range in the specified collection into an array.static <A,T extends A>
A[]toArray(Collection<? extends T> c, int fromIndex, int toIndex, Class<A[]> targetType) Converts the specified range in the specified collection into an array of a specified type.static <A,T extends A>
A[]toArray(Collection<? extends T> c, int fromIndex, int toIndex, IntFunction<A[]> arraySupplier) Converts the specified range in the specified collection into an array using a provided array supplier function.static <A,T extends A>
A[]toArray(Collection<? extends T> c, A[] a) Converts a collection into an array.static <A,T extends A>
A[]toArray(Collection<? extends T> c, Class<A[]> targetType) Converts a collection into an array of a specified type.static <A,T extends A>
A[]toArray(Collection<? extends T> c, IntFunction<A[]> arraySupplier) Converts a collection into an array using a provided array supplier function.static boolean[]toBooleanArray(byte[] a) Converts a byte array to a boolean array.static boolean[]toBooleanArray(int[] a) Converts an integer array to a boolean array.static boolean[]Converts a collection of Boolean objects to a boolean array.static boolean[]toBooleanArray(Collection<Boolean> c, boolean defaultForNull) Converts a collection of Boolean objects to a boolean array.static boolean[]toBooleanArray(Collection<Boolean> c, int fromIndex, int toIndex) Converts the specified range of the specified Boolean collection to a boolean array.static boolean[]toBooleanArray(Collection<Boolean> c, int fromIndex, int toIndex, boolean defaultForNull) Converts the specified range of the specified Boolean collection to a boolean array.static byte[]toByteArray(boolean[] a) Converts a boolean array to a byte array.static byte[]toByteArray(Collection<? extends Number> c) Converts a collection of Number objects to a byte array.static byte[]toByteArray(Collection<? extends Number> c, byte defaultForNull) Converts a collection of Number objects to a byte array.static byte[]toByteArray(Collection<? extends Number> c, int fromIndex, int toIndex) Converts the specified range of the specified Number collection to a byte array.static byte[]toByteArray(Collection<? extends Number> c, int fromIndex, int toIndex, byte defaultForNull) Converts the specified range of the specified Number collection to a byte array.static char[]Converts a collection of Character objects to a char array.static char[]toCharArray(Collection<Character> c, char defaultForNull) Converts a collection of Character objects to a char array.static char[]toCharArray(Collection<Character> c, int fromIndex, int toIndex) Converts the specified range of the specified character collection to a char array.static char[]toCharArray(Collection<Character> c, int fromIndex, int toIndex, char defaultForNull) Converts the specified range of the specified character collection to a char array.static <C extends Collection<Boolean>>
CtoCollection(boolean[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the boolean array to a specified type of Collection.static <C extends Collection<Boolean>>
CtoCollection(boolean[] a, IntFunction<? extends C> supplier) Converts a boolean array to a specified type of Collection.static <C extends Collection<Byte>>
CtoCollection(byte[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the byte array to a specified type of Collection.static <C extends Collection<Byte>>
CtoCollection(byte[] a, IntFunction<? extends C> supplier) Converts a byte array to a specified type of Collection.static <C extends Collection<Character>>
CtoCollection(char[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the char array to a specified type of Collection.static <C extends Collection<Character>>
CtoCollection(char[] a, IntFunction<? extends C> supplier) Converts a char array to a specified type of Collection.static <C extends Collection<Double>>
CtoCollection(double[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the double array to a specified type of Collection.static <C extends Collection<Double>>
CtoCollection(double[] a, IntFunction<? extends C> supplier) Converts a double array to a specified type of Collection.static <C extends Collection<Float>>
CtoCollection(float[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the float array to a specified type of Collection.static <C extends Collection<Float>>
CtoCollection(float[] a, IntFunction<? extends C> supplier) Converts a float array to a specified type of Collection.static <C extends Collection<Integer>>
CtoCollection(int[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the int array to a specified type of Collection.static <C extends Collection<Integer>>
CtoCollection(int[] a, IntFunction<? extends C> supplier) Converts an int array to a specified type of Collection.static <C extends Collection<Long>>
CtoCollection(long[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the long array to a specified type of Collection.static <C extends Collection<Long>>
CtoCollection(long[] a, IntFunction<? extends C> supplier) Converts a long array to a specified type of Collection.static <C extends Collection<Short>>
CtoCollection(short[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the short array to a specified type of Collection.static <C extends Collection<Short>>
CtoCollection(short[] a, IntFunction<? extends C> supplier) Converts a short array to a specified type of Collection.static <T,C extends Collection<T>>
CtoCollection(Iterable<? extends T> c, IntFunction<? extends C> supplier) Converts an Iterable to a specified type of Collection.static <T,C extends Collection<T>>
CtoCollection(Iterator<? extends T> iter, Supplier<? extends C> supplier) Converts an Iterator to a specified type of Collection.static <T,C extends Collection<T>>
CtoCollection(T[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) Converts the specified range of the array to a specified type of Collection.static <T,C extends Collection<T>>
CtoCollection(T[] a, IntFunction<? extends C> supplier) Converts an array of objects to a specified type of Collection.static double[]toDoubleArray(Collection<? extends Number> c) Converts a collection of Number objects to a double array.static double[]toDoubleArray(Collection<? extends Number> c, double defaultForNull) Converts a collection of Number objects to a double array.static double[]toDoubleArray(Collection<? extends Number> c, int fromIndex, int toIndex) Converts the specified range of the specified Number collection to a double array.static double[]toDoubleArray(Collection<? extends Number> c, int fromIndex, int toIndex, double defaultForNull) Converts the specified range of the specified Number collection to a double array.static float[]toFloatArray(Collection<? extends Number> c) Converts a collection of Number objects to a float array.static float[]toFloatArray(Collection<? extends Number> c, float defaultForNull) Converts a collection of Number objects to a float array.static float[]toFloatArray(Collection<? extends Number> c, int fromIndex, int toIndex) Converts the specified range of the specified Number collection to a float array.static float[]toFloatArray(Collection<? extends Number> c, int fromIndex, int toIndex, float defaultForNull) Converts the specified range of the specified Number collection to a float array.static int[]toIntArray(boolean[] a) Converts a boolean array to an int array.static int[]toIntArray(char[] a) Converts a char array to an int array.static int[]toIntArray(Collection<? extends Number> c) Converts a collection of Number objects to an int array.static int[]toIntArray(Collection<? extends Number> c, int defaultForNull) Converts a collection of Number objects to an int array.static int[]toIntArray(Collection<? extends Number> c, int fromIndex, int toIndex) Converts the specified range of the specified Number collection to an int array.static int[]toIntArray(Collection<? extends Number> c, int fromIndex, int toIndex, int defaultForNull) Converts the specified range of the specified Number collection to an int array.static StringConverts the given object to its JSON string representation.static StringConverts the given object to its JSON string representation with an option for pretty formatting.static StringtoJson(Object obj, JSONSerializationConfig config) Converts the given object to its JSON string representation with the specifiedJSONSerializationConfig.static voidtoJson(Object obj, JSONSerializationConfig config, File output) Converts the given object to its JSON string representation with an option for pretty formatting and writes it to the specified file.static voidtoJson(Object obj, JSONSerializationConfig config, OutputStream output) Converts the given object to its JSON string representation with an option for pretty formatting and writes it to the specified output stream.static voidtoJson(Object obj, JSONSerializationConfig config, Writer output) Converts the given object to its JSON string representation with an option for pretty formatting and writes it to the specified writer.static voidConverts the given object to its JSON string representation and writes it to the specified file.static voidtoJson(Object obj, OutputStream output) Converts the given object to its JSON string representation and writes it to the specified output stream.static voidConverts the given object to its JSON string representation and writes it to the specified writer.toList(boolean[] a) Converts a boolean array to a modifiable List, which is NOT backed with the input arraytoList(boolean[] a, int fromIndex, int toIndex) Converts the specified range of the array to a modifiable List, which is NOT backed with the input arraytoList(byte[] a) Converts a byte array to a modifiable List, which is NOT backed with the input arraytoList(byte[] a, int fromIndex, int toIndex) Converts the specified range of the byte array to a modifiable List, which is NOT backed with the input arraytoList(char[] a) Converts a char array to a modifiable List, which is NOT backed with the input arraytoList(char[] a, int fromIndex, int toIndex) Converts the specified range of the array to a modifiable List, which is NOT backed with the input arraytoList(double[] a) Converts a double array to a modifiable List, which is NOT backed with the input arraytoList(double[] a, int fromIndex, int toIndex) Converts the specified range of the double array to a modifiable List, which is NOT backed with the input arraytoList(float[] a) Converts a float array to a modifiable List, which is NOT backed with the input arraytoList(float[] a, int fromIndex, int toIndex) Converts the specified range of the float array to a modifiable List, which is NOT backed with the input arraytoList(int[] a) Converts an int array to a modifiable List, which is NOT backed with the input arraytoList(int[] a, int fromIndex, int toIndex) Converts the specified range of the int array to a modifiable List, which is NOT backed with the input arraytoList(long[] a) Converts a long array to a modifiable List, which is NOT backed with the input arraytoList(long[] a, int fromIndex, int toIndex) Converts the specified range of the long array to a modifiable List, which is NOT backed with the input arraytoList(short[] a) Converts a short array to a modifiable List, which is NOT backed with the input arraytoList(short[] a, int fromIndex, int toIndex) Converts the specified range of the short array to a modifiable List, which is NOT backed with the input arraystatic <T> List<T> Converts an Iterator of objects to a modifiable List.static <T> List<T> toList(T[] a) Converts an array of objects to a modifiable List, which is NOT backed with the input array.static <T> List<T> toList(T[] a, int fromIndex, int toIndex) Converts the specified range of the array to a modifiable List, which is NOT backed with the input array.static long[]toLongArray(Collection<? extends Number> c) Converts a collection of Number objects to a long array.static long[]toLongArray(Collection<? extends Number> c, int fromIndex, int toIndex) Converts the specified range of the specified Number collection to a long array.static long[]toLongArray(Collection<? extends Number> c, int fromIndex, int toIndex, long defaultForNull) Converts the specified range of the specified Number collection to a long array.static long[]toLongArray(Collection<? extends Number> c, long defaultForNull) Converts a collection of Number objects to a long array.static <T,K> Map <K, T> Converts an Iterable to a Map using a key extractor function.static <T,K, V> Map <K, V> toMap(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) Converts an Iterable to a Map using key and value extractor functions.static <T,K, V, M extends Map<K, V>>
MtoMap(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, BiFunction<? super V, ? super V, ? extends V> mergeFunction, IntFunction<? extends M> mapSupplier) Converts an Iterable to a Map using key and value extractor functions, with a custom Map supplier.static <T,K, V, M extends Map<K, V>>
MtoMap(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, IntFunction<? extends M> mapSupplier) Converts an Iterable to a Map using key and value extractor functions, with a custom Map supplier.static <T,K> Map <K, T> Converts an Iterator to a Map using a key extractor function.static <T,K, V> Map <K, V> toMap(Iterator<? extends T> iter, Function<? super T, K> keyExtractor, Function<? super T, ? extends V> valueExtractor) Converts an Iterator to a Map using key and value extractor functions.static <T,K, V, M extends Map<K, V>>
MtoMap(Iterator<? extends T> iter, Function<? super T, K> keyExtractor, Function<? super T, ? extends V> valueExtractor, BiFunction<? super V, ? super V, ? extends V> mergeFunction, Supplier<? extends M> mapSupplier) Converts an Iterator to a Map using key and value extractor functions, with a custom Map supplier.static <T,K, V, M extends Map<K, V>>
MtoMap(Iterator<? extends T> iter, Function<? super T, K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<? extends M> mapSupplier) Converts an Iterator to a Map using key and value extractor functions, with a custom Map supplier.static double[]top(double[] a, int n) Returns the top n elements from the specified array.static double[]top(double[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range in the input array.static double[]top(double[] a, int fromIndex, int toIndex, int n, Comparator<? super Double> cmp) Returns the top n elements from a specified range in the input array according to the provided comparator.static double[]top(double[] a, int n, Comparator<? super Double> cmp) Returns the top n elements from the specified array according to the provided comparator.static float[]top(float[] a, int n) Returns the top n elements from the specified array.static float[]top(float[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range in the input array.static float[]top(float[] a, int fromIndex, int toIndex, int n, Comparator<? super Float> cmp) Returns the top n elements from a specified range in the input array according to the provided comparator.static float[]top(float[] a, int n, Comparator<? super Float> cmp) Returns the top n elements from the specified array according to the provided comparator.static int[]top(int[] a, int n) Returns the top n elements from the specified array.static int[]top(int[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range in the input array.static int[]top(int[] a, int fromIndex, int toIndex, int n, Comparator<? super Integer> cmp) Returns the top n elements from a specified range in the input array according to the provided comparator.static int[]top(int[] a, int n, Comparator<? super Integer> cmp) Returns the top n elements from the specified array according to the provided comparator.static long[]top(long[] a, int n) Returns the top n elements from the specified array.static long[]top(long[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range in the input array.static long[]top(long[] a, int fromIndex, int toIndex, int n, Comparator<? super Long> cmp) Returns the top n elements from a specified range in the input array according to the provided comparator.static long[]top(long[] a, int n, Comparator<? super Long> cmp) Returns the top n elements from the specified array according to the provided comparator.static short[]top(short[] a, int n) Returns the top n elements from the specified array.static short[]top(short[] a, int fromIndex, int toIndex, int n) Returns the top n elements from a specified range in the input array.static short[]top(short[] a, int fromIndex, int toIndex, int n, Comparator<? super Short> cmp) Returns the top n elements from a specified range in the input array according to the provided comparator.static short[]top(short[] a, int n, Comparator<? super Short> cmp) Returns the top n elements from the specified array according to the provided comparator.static <T extends Comparable<? super T>>
List<T> top(Collection<? extends T> c, int n) Returns the top n elements from the specified collection based on their natural ordering.static <T extends Comparable<? super T>>
List<T> top(Collection<? extends T> c, int n, boolean keepEncounterOrder) Returns the top n elements from the specified collection based on their natural ordering.static <T extends Comparable<? super T>>
List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n) Returns the top n elements from the specified range in the input collection based on their natural ordering.static <T extends Comparable<? super T>>
List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, boolean keepEncounterOrder) Returns the top n elements from the specified range in the input collection based on their natural ordering.static <T> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, Comparator<? super T> cmp) Returns the top n elements from the specified range in the input collection according to the provided comparator.static <T> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the specified range in the input collection according to the provided comparator.static <T> List<T> top(Collection<? extends T> c, int n, Comparator<? super T> cmp) Returns the top n elements from the specified collection according to the provided comparator.static <T> List<T> top(Collection<? extends T> c, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the specified collection according to the provided comparator.static <T extends Comparable<? super T>>
List<T> top(T[] a, int n) Returns the top n elements from the specified array based on their natural ordering.static <T extends Comparable<? super T>>
List<T> top(T[] a, int n, boolean keepEncounterOrder) Returns the top n elements from the specified array based on their natural ordering.static <T extends Comparable<? super T>>
List<T> top(T[] a, int fromIndex, int toIndex, int n) Returns the top n elements from the specified range in the input array based on their natural ordering.static <T extends Comparable<? super T>>
List<T> top(T[] a, int fromIndex, int toIndex, int n, boolean keepEncounterOrder) Returns the top n elements from the specified range in the input array based on their natural ordering.static <T> List<T> top(T[] a, int fromIndex, int toIndex, int n, Comparator<? super T> cmp) Returns the top n elements from the specified range in the input array according to the provided comparator.static <T> List<T> top(T[] a, int fromIndex, int toIndex, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the specified range in the input array according to the provided comparator.static <T> List<T> top(T[] a, int n, Comparator<? super T> cmp) Returns the top n elements from the specified array according to the provided comparator.static <T> List<T> top(T[] a, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the specified array according to the provided comparator.static RuntimeExceptionConverts the provided exception to a runtime exception.static RuntimeExceptionConverts the specifiedThrowableto aRuntimeExceptionif it's a checkedexceptionor anError, otherwise returns itself.static RuntimeExceptiontoRuntimeException(Throwable e, boolean throwIfItIsError) Converts the specifiedThrowableto aRuntimeExceptionif it's a checked exception, or throws it if it's anError, based on the provided flag.toSet(boolean[] a) Converts a boolean array to a modifiable Set, which is NOT backed with the input array.toSet(boolean[] a, int fromIndex, int toIndex) Converts the specified range of the boolean array to a modifiable Set, which is NOT backed with the input array.toSet(byte[] a) Converts a byte array to a modifiable Set, which is NOT backed with the input array.toSet(byte[] a, int fromIndex, int toIndex) Converts the specified range of the byte array to a modifiable Set, which is NOT backed with the input array.toSet(char[] a) Converts a char array to a modifiable Set, which is NOT backed with the input array.toSet(char[] a, int fromIndex, int toIndex) Converts the specified range of the char array to a modifiable Set, which is NOT backed with the input array.toSet(double[] a) Converts a double array to a modifiable Set, which is NOT backed with the input array.toSet(double[] a, int fromIndex, int toIndex) Converts the specified range of the double array to a modifiable Set, which is NOT backed with the input array.toSet(float[] a) Converts a float array to a Set of, which is NOT backed with the input array.toSet(float[] a, int fromIndex, int toIndex) Converts the specified range of the float array to a modifiable Set, which is NOT backed with the input array.toSet(int[] a) Converts an int array to a modifiable Set, which is NOT backed with the input array.toSet(int[] a, int fromIndex, int toIndex) Converts the specified range of the int array to a modifiable Set, which is NOT backed with the input array.toSet(long[] a) Converts a long array to a modifiable Set, which is NOT backed with the input array.toSet(long[] a, int fromIndex, int toIndex) Converts the specified range of the long array to a modifiable Set, which is NOT backed with the input array.toSet(short[] a) Converts a short array to a modifiable Set, which is NOT backed with the input array.toSet(short[] a, int fromIndex, int toIndex) Converts the specified range of the short array to a modifiable Set, which is NOT backed with the input array.static <T> Set<T> Converts an Iterator of objects to a modifiable Set.static <T> Set<T> toSet(T[] a) Converts an array of objects to a modifiable Set, which is NOT backed with the input array.static <T> Set<T> toSet(T[] a, int fromIndex, int toIndex) Converts the specified range of the array to a modifiable Set, which is NOT backed with the input array.static short[]toShortArray(Collection<? extends Number> c) Converts a collection of Number objects to a short array.static short[]toShortArray(Collection<? extends Number> c, int fromIndex, int toIndex) Converts the specified range of the specified Number collection to a short array.static short[]toShortArray(Collection<? extends Number> c, int fromIndex, int toIndex, short defaultForNull) Converts the specified range of the specified Number collection to a short array.static short[]toShortArray(Collection<? extends Number> c, short defaultForNull) Converts a collection of Number objects to a short array.static StringtoString(boolean value) Returns a string representation of the specified boolean value.static StringtoString(boolean[] a) Returns a string representation of the specified boolean array.static StringtoString(boolean[] a, int fromIndex, int toIndex) Returns a string representation of the specified range of elements in a boolean array.static StringtoString(byte value) Returns a string representation of the specified byte value.static StringtoString(byte[] a) Returns a string representation of the specified byte array.static StringtoString(byte[] a, int fromIndex, int toIndex) Returns a string representation of the specified range of elements in a byte array.static StringtoString(char value) Returns a string representation of the specified char value.static StringtoString(char[] a) Returns a string representation of the specified char array.static StringtoString(char[] a, int fromIndex, int toIndex) Returns a string representation of the specified range of elements in a char array.static StringtoString(double value) Returns a string representation of the specified double value.static StringtoString(double[] a) Returns a string representation of the specified double array.static StringtoString(double[] a, int fromIndex, int toIndex) Returns a string representation of the specified range of elements in a double array.static StringtoString(float value) Returns a string representation of the specified float value.static StringtoString(float[] a) Returns a string representation of the specified float array.static StringtoString(float[] a, int fromIndex, int toIndex) Returns a string representation of the specified range of elements in a float array.static StringtoString(int value) Returns a string representation of the specified int value.static StringtoString(int[] a) Returns a string representation of the specified int array.static StringtoString(int[] a, int fromIndex, int toIndex) Returns a string representation of the specified range of elements in an int array.static StringtoString(long value) Returns a string representation of the specified long value.static StringtoString(long[] a) Returns a string representation of the specified long array.static StringtoString(long[] a, int fromIndex, int toIndex) Returns a string representation of the specified range of elements in a long array.static StringtoString(short value) Returns a string representation of the specified short value.static StringtoString(short[] a) Returns a string representation of the specified short array.static StringtoString(short[] a, int fromIndex, int toIndex) Returns a string representation of the specified range of elements in a short array.static StringReturns a string representation of the specified object.static StringReturns a string representation of the specified Object array.static StringReturns a string representation of the specified range of elements in an Object array.static StringReturns a string representation of the specified object.static StringConverts the given object into an XML string representation.static StringConverts the given object to its XML string representation with an option for pretty formatting.static StringtoXml(Object obj, XMLSerializationConfig config) Converts the given object to its XML string representation with the specifiedXMLSerializationConfig.static voidtoXml(Object obj, XMLSerializationConfig config, File output) Converts the given object to its XML string representation with the specifiedXMLSerializationConfigand writes it to the specified file.static voidtoXml(Object obj, XMLSerializationConfig config, OutputStream output) Converts the given object to its XML string representation with the specifiedXMLSerializationConfigand writes it to the specified output stream.static voidtoXml(Object obj, XMLSerializationConfig config, Writer output) Converts the given object to its XML string representation with the specifiedXMLSerializationConfigand writes it to the specified writer.static voidConverts the given object to its XML string representation and writes it to the specified file.static voidtoXml(Object obj, OutputStream output) Converts the given object to its XML string representation and writes it to the specified output stream.static voidConverts the given object to its XML string representation and writes it to the specified writer.static <R> RtryOrDefaultIfExceptionOccurred(Callable<R> cmd, Supplier<R> supplierForDefaultIfExceptionOccurred) Executes the givenCallableand returns the result.static <R> RtryOrDefaultIfExceptionOccurred(Callable<R> cmd, R defaultIfExceptionOccurred) Executes the givenCallableand returns the result.static <T,R> R tryOrDefaultIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func, Supplier<R> supplierForDefaultIfExceptionOccurred) Executes the given function with the provided initial value and returns the result.static <T,R> R tryOrDefaultIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func, R defaultIfExceptionOccurred) Executes the given function with the provided initial value and returns the result.static <R> u.Nullable<R> Executes the givenCallableand returns aNullablecontaining the result.static <T,R> u.Nullable <R> tryOrEmptyIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func) Executes the given function with the provided initial value and returns aNullablecontaining the result.static <T> com.landawn.abacus.type.Type<T> Gets a Type by the givenClass.static <T> com.landawn.abacus.type.Type<T> Gets a Type by the given type name.static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c) Returns an unmodifiable view of the specified collection, or an immutable/unmodifiable empty collection if the specified collection isnull.static <T> List<T> unmodifiableList(List<? extends T> list) Returns an unmodifiable view of the specified list, or an immutable/unmodifiable empty list if the specified list isnull.static <K,V> Map <K, V> unmodifiableMap(Map<? extends K, ? extends V> m) Returns an unmodifiable view of the specified map, or an immutable/unmodifiable empty map if the specified map isnull.static <K,V> NavigableMap <K, V> unmodifiableNavigableMap(NavigableMap<K, ? extends V> m) Returns an unmodifiable view of the specified navigable map, or an immutable/unmodifiable empty navigable map if the specified map isnull.static <T> NavigableSet<T> Returns an unmodifiable view of the specified navigable set, or an immutable/unmodifiable empty navigable set if the specified navigable set isnull.static <T> Set<T> unmodifiableSet(Set<? extends T> s) Returns an unmodifiable view of the specified set, or an immutable/unmodifiable empty set if the specified set isnull.static <K,V> SortedMap <K, V> unmodifiableSortedMap(SortedMap<K, ? extends V> m) Returns an unmodifiable view of the specified sorted map, or an immutable/unmodifiable empty sorted map if the specified map isnull.static <T> SortedSet<T> Returns an unmodifiable view of the specified sorted set, or an immutable/unmodifiable empty sorted set if the specified sorted set isnull.unzip(Iterable<? extends T> c, BiConsumer<? super T, Pair<A, B>> unzip) Unzips an iterable into two separate lists using the provided unzip function.static <T,A, B, LC extends Collection<A>, RC extends Collection<B>>
Pair<LC, RC> unzip(Iterable<? extends T> c, BiConsumer<? super T, Pair<A, B>> unzip, IntFunction<? extends Collection<?>> supplier) Unzips an iterable into two separate collections using the provided unzip function.unzipp(Iterable<? extends T> c, BiConsumer<? super T, Triple<A, B, C>> unzip) Deprecated.replaced byTriIterator.unzip(Iterable, BiConsumer)static <T,A, B, C, LC extends Collection<A>, MC extends Collection<B>, RC extends Collection<C>>
Triple<LC, MC, RC> unzipp(Iterable<? extends T> c, BiConsumer<? super T, Triple<A, B, C>> unzip, IntFunction<? extends Collection<?>> supplier) Deprecated.replaced byinvalid reference
TriIterator#unzip(Iterable, BiConsumer, Supplier)static voidDeprecated.usereplaceAllstatic voidDeprecated.usereplaceIfstatic <T> TConverts the given string to its corresponding value of the specified target type bytypeOf(targetType).valueOf(str).static StringConverts the given XML string to its JSON string representation.static StringConverts the given XML string to its JSON string representation.static <A,B, R> List <R> zip(A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction) Zips two arrays into a single list using the provided zip function.static <A,B, R> R[] zip(A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction, Class<R> targetElementType) Zips two arrays into a single array using the provided zip function.static <A,B, C, R>
List<R> zip(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) Zips three arrays into a single list using the provided zip function.static <A,B, C, R>
R[]zip(A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, Class<R> targetElementType) Zips three arrays into a single array using the provided zip function.static <A,B, C, R>
List<R> zip(A[] a, B[] b, C[] c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) Zips three arrays into a single list using the provided zip function.static <A,B, C, R>
R[]zip(A[] a, B[] b, C[] c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction, Class<R> targetElementType) Zips three arrays into a single array using the provided zip function.static <A,B, R> List <R> zip(A[] a, B[] b, BiFunction<? super A, ? super B, ? extends R> zipFunction) Zips two arrays into a single list using the provided zip function.static <A,B, R> R[] zip(A[] a, B[] b, BiFunction<? super A, ? super B, ? extends R> zipFunction, Class<R> targetElementType) Zips two arrays into a single array using the provided zip function.static <A,B, R> List <R> zip(Iterable<A> a, Iterable<B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction) Zips two iterables into a single list using the provided zip function.static <A,B, C, R>
List<R> zip(Iterable<A> a, Iterable<B> b, Iterable<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) Zips three iterables into a single list using the provided zip function.static <A,B, C, R>
List<R> zip(Iterable<A> a, Iterable<B> b, Iterable<C> c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) Zips three iterables into a single list using the provided zip function.static <A,B, R> List <R> zip(Iterable<A> a, Iterable<B> b, BiFunction<? super A, ? super B, ? extends R> zipFunction) Zips two iterables into a single list using the provided zip function.
-
Field Details
-
INDEX_NOT_FOUND
public static final int INDEX_NOT_FOUNDThe index value when an element is not found in a list or array:-1. This value is returned by methods in this class and can also be used in comparisons with values returned by various method fromList.- See Also:
-
EMPTY_BOOLEAN_ARRAY
public static final boolean[] EMPTY_BOOLEAN_ARRAYAn empty immutable/unmodifiablebooleanarray. -
EMPTY_CHAR_ARRAY
public static final char[] EMPTY_CHAR_ARRAYAn empty immutable/unmodifiablechararray. -
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAYAn empty immutable/unmodifiablebytearray. -
EMPTY_SHORT_ARRAY
public static final short[] EMPTY_SHORT_ARRAYAn empty immutable/unmodifiableshortarray. -
EMPTY_INT_ARRAY
public static final int[] EMPTY_INT_ARRAYAn empty immutable/unmodifiableintarray. -
EMPTY_LONG_ARRAY
public static final long[] EMPTY_LONG_ARRAYAn empty immutable/unmodifiablelongarray. -
EMPTY_FLOAT_ARRAY
public static final float[] EMPTY_FLOAT_ARRAYAn empty immutable/unmodifiablefloatarray. -
EMPTY_DOUBLE_ARRAY
public static final double[] EMPTY_DOUBLE_ARRAYAn empty immutable/unmodifiabledoublearray. -
EMPTY_BOOLEAN_OBJ_ARRAY
An empty immutable/unmodifiableBooleanarray. -
EMPTY_CHAR_OBJ_ARRAY
An empty immutable/unmodifiableCharacterarray. -
EMPTY_BYTE_OBJ_ARRAY
An empty immutable/unmodifiableBytearray. -
EMPTY_SHORT_OBJ_ARRAY
An empty immutable/unmodifiableShortarray. -
EMPTY_INT_OBJ_ARRAY
An empty immutable/unmodifiableIntegerarray. -
EMPTY_LONG_OBJ_ARRAY
An empty immutable/unmodifiableLongarray. -
EMPTY_FLOAT_OBJ_ARRAY
An empty immutable/unmodifiableFloatarray. -
EMPTY_DOUBLE_OBJ_ARRAY
An empty immutable/unmodifiableDoublearray. -
EMPTY_BIG_INTEGER_ARRAY
An empty immutable/unmodifiableBigIntegerarray. -
EMPTY_BIG_DECIMAL_ARRAY
An empty immutable/unmodifiableBigDecimalarray. -
EMPTY_STRING_ARRAY
An empty immutable/unmodifiableStringarray. -
EMPTY_JU_DATE_ARRAY
An empty immutable/unmodifiablejava.util.Datearray. -
EMPTY_DATE_ARRAY
An empty immutable/unmodifiablejava.sql.Datearray. -
EMPTY_TIME_ARRAY
An empty immutable/unmodifiableTimearray. -
EMPTY_TIMESTAMP_ARRAY
An empty immutable/unmodifiableTimestamparray. -
EMPTY_CALENDAR_ARRAY
/** An empty immutable/unmodifiableCalendararray. -
EMPTY_LOCAL_DATE_ARRAY
/** An empty immutable/unmodifiableLocalDatearray. -
EMPTY_LOCAL_TIME_ARRAY
/** An empty immutable/unmodifiableLocalTimearray. -
EMPTY_LOCAL_DATE_TIME_ARRAY
/** An empty immutable/unmodifiableLocalDateTimearray. -
EMPTY_OBJECT_ARRAY
An empty immutable/unmodifiableObjectarray.
-
-
Method Details
-
occurrencesOf
public static int occurrencesOf(boolean[] a, boolean valueToFind) Counts the occurrences of a specific boolean value in a boolean array.- Parameters:
a- The boolean array to be checked for the presence of the valueToFind.valueToFind- The boolean value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
public static int occurrencesOf(char[] a, char valueToFind) Counts the occurrences of a specific char value in a char array.- Parameters:
a- The char array to be checked for the presence of the valueToFind.valueToFind- The char value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
public static int occurrencesOf(byte[] a, byte valueToFind) Counts the occurrences of a specific byte value in a byte array.- Parameters:
a- The byte array to be checked for the presence of the valueToFind.valueToFind- The byte value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
public static int occurrencesOf(short[] a, short valueToFind) Counts the occurrences of a specific short value in a short array.- Parameters:
a- The short array to be checked for the presence of the valueToFind.valueToFind- The short value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
public static int occurrencesOf(int[] a, int valueToFind) Counts the occurrences of a specific int value in a int array.- Parameters:
a- The int array to be checked for the presence of the valueToFind.valueToFind- The int value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
public static int occurrencesOf(long[] a, long valueToFind) Counts the occurrences of a specific long value in a long array.- Parameters:
a- The long array to be checked for the presence of the valueToFind.valueToFind- The long value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
public static int occurrencesOf(float[] a, float valueToFind) Counts the occurrences of a specific float value in a float array.- Parameters:
a- The float array to be checked for the presence of the valueToFind.valueToFind- The float value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
public static int occurrencesOf(double[] a, double valueToFind) Counts the occurrences of a specific double value in a double array.- Parameters:
a- The double array to be checked for the presence of the valueToFind.valueToFind- The double value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
Counts the occurrences of a specific Object value in an Object array.- Parameters:
a- The Object array to be checked for the presence of the valueToFind.valueToFind- The Object value to be checked for its occurrences in the array a.- Returns:
- The number of occurrences of valueToFind in array a. Returns 0 if the array is
nullor empty.
-
occurrencesOf
Counts the occurrences of a specific Object value in anIterable.- Parameters:
c- TheIterableto be checked for the presence of the valueToFind.valueToFind- The Object value to be checked for its occurrences in theIterablec.- Returns:
- The number of occurrences of valueToFind in
Iterablec. Returns 0 if theIterableisnull.
-
occurrencesOf
Counts the occurrences of a specific Object value in anIterator.- Parameters:
iter- TheIteratorto be checked for the presence of the valueToFind.valueToFind- The Object value to be checked for its occurrences in the Iterator iter.- Returns:
- The number of occurrences of valueToFind in Iterator iter. Returns 0 if the Iterator is
null. - Throws:
ArithmeticException- if the number of occurrences exceeds Integer.MAX_VALUE.- See Also:
-
occurrencesOf
Counts the occurrences of a specific character in a String.- Parameters:
str- The String to be checked for the presence of the valueToFind.valueToFind- The character to be checked for its occurrences in the String str.- Returns:
- The number of occurrences of valueToFind in String str. Returns 0 if the String is
nullor empty. - See Also:
-
occurrencesOf
Counts the occurrences of a specific String value in another String.- Parameters:
str- The String to be checked for the presence of the valueToFind.valueToFind- The String value to be checked for its occurrences in the String str.- Returns:
- The number of occurrences of valueToFind in String str. Returns 0 if the String is
nullor empty. - See Also:
-
occurrencesMap
Returns a map with the occurrences of each element in the given array. The map's keys are the distinct elements in the array, and their corresponding values are the number of occurrences of each element. If the input array isnullor empty, an empty map is returned.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array to count occurrences from- Returns:
- a Map containing the elements of the array as keys and their occurrences as values
-
occurrencesMap
Returns a map with the occurrences of each element in the given array. The map's keys are the distinct elements in the array, and their corresponding values are the number of occurrences of each element. If the input array isnullor empty, a map provided by the supplied map supplier is returned.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array to count occurrences frommapSupplier- the supplier of the map to be used for collecting occurrences- Returns:
- a Map containing the elements of the array as keys and their occurrences as values
-
occurrencesMap
Returns a map with the occurrences of each element in the given iterable collection. The map's keys are the distinct elements in the collection, and their corresponding values are the number of occurrences of each element. If the input collection isnull, an empty map is returned.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the collection to count occurrences from- Returns:
- a Map containing the elements of the collection as keys and their occurrences as values
-
occurrencesMap
public static <T> Map<T,Integer> occurrencesMap(Iterable<? extends T> c, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given iterable collection. The map's keys are the distinct elements in the collection, and their corresponding values are the number of occurrences of each element. If the input collection isnull, a map provided by the supplied map supplier is returned.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the collection to count occurrences frommapSupplier- the supplier of the map to be used for collecting occurrences- Returns:
- a Map containing the elements of the collection as keys and their occurrences as values
-
occurrencesMap
Returns a map with the occurrences of each element in the given iterator. The map's keys are the distinct elements in the iterator, and their corresponding values are the number of occurrences of each element. If the input iterator isnullor empty, an empty map is returned.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the iterator to count occurrences from- Returns:
- a Map containing the elements of the iterator as keys and their occurrences as values
-
occurrencesMap
public static <T> Map<T,Integer> occurrencesMap(Iterator<? extends T> iter, Supplier<Map<T, Integer>> mapSupplier) Returns a map with the occurrences of each element in the given iterator. The map's keys are the distinct elements in the iterator, and their corresponding values are the number of occurrences of each element. If the input iterator isnullor empty, a map provided by the supplied map supplier is returned.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the iterator to count occurrences frommapSupplier- the supplier of the map to be used for collecting occurrences- Returns:
- a Map containing the elements of the iterator as keys and their occurrences as values
-
contains
public static boolean contains(boolean[] a, boolean valueToFind) Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
public static boolean contains(char[] a, char valueToFind) Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
public static boolean contains(byte[] a, byte valueToFind) Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
public static boolean contains(short[] a, short valueToFind) Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
public static boolean contains(int[] a, int valueToFind) Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
public static boolean contains(long[] a, long valueToFind) Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
public static boolean contains(float[] a, float valueToFind) Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
public static boolean contains(double[] a, double valueToFind) Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
Checks if the specified array contains the specified value.- Parameters:
a- The array to be checked for the presence of the value.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseif a isnullor empty orvalueToFindis not found.
-
contains
Checks if the specified Collection contains the specified value.- Parameters:
c- The Collection to be checked for the presence of the Collection.valueToFind- The value to be checked for its presence in the array.- Returns:
trueif the array contains the specified value,falseifvalueToFindis not found or c isnullor empty.
-
contains
Checks if the specifiedIterablecontains the specified value.- Parameters:
c- TheIterableto be checked for the presence of the value.valueToFind- The value to be checked for its presence in theIterable.- Returns:
trueif the array contains the specified value,falseifvalueToFindis not found or c isnullor empty.
-
contains
Checks if the specified Iterator contains the specified value.- Parameters:
valueToFind- The value to be checked for its presence in the Iterator.c- TheIteratorto be checked for the presence of the value.- Returns:
trueif the array contains the specified value,falseifvalueToFindis not found or c isnullor empty.
-
containsAll
Checks if the givenCollectioncontains all the elements in the specifiedvaluesToFindCollection.- Parameters:
c- TheCollectionto be checked for the presence of the elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenCollection.- Returns:
trueif the givenCollectioncontains all the elements invaluesToFindorvaluesToFindisnullor empty,falseotherwise if any element invaluesToFindis not found in the givenCollectionor the givenCollectionisnullor empty.
-
containsAll
Checks if the givenCollectioncontains all the elements in the specifiedvaluesToFindarray.- Parameters:
c- TheCollectionto be checked for the presence of the elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenCollection.- Returns:
trueif the givenCollectioncontains all the elements invaluesToFindorvaluesToFindisnullor empty,falseotherwise if any element invaluesToFindis not found in the givenCollectionor the givenCollectionisnullor empty.
-
containsAll
Checks if the givenIterablecontains all the elements in the specifiedvaluesToFindCollection.- Parameters:
c- TheIterableto be checked for the presence of the elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenIterable.- Returns:
trueif the givenIterablecontains all the elements invaluesToFindorvaluesToFindisnullor empty,falseotherwise if any element invaluesToFindis not found is not found in the givenIterableor the givenIterableisnullor empty.
-
containsAll
Checks if the givenIteratorcontains all the elements in the specifiedvaluesToFindCollection.- Parameters:
valuesToFind- The values to be checked for their presence in the givenIterator.c- TheIteratorto be checked for the presence of the elements in valuesToFind.- Returns:
trueif the givenIteratorcontains all the elements invaluesToFindorvaluesToFindisnullor empty,falseotherwise if any element invaluesToFindis not found in the givenIteratoror the givenIteratorisnullor empty.
-
containsAny
Checks if the givenCollectioncontains any elements from the specifiedvaluesToFindCollection.- Parameters:
c- TheCollectionto be checked for the presence of any elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenCollection.- Returns:
trueif the givenCollectioncontains any elements invaluesToFind,falseotherwise if doesn't or if the givenCollectionisnullor empty, or if the specifiedvaluesToFindisnullor empty.
-
containsAny
Checks if the givenCollectioncontains any elements from the specifiedvaluesToFindarray.- Parameters:
c- TheCollectionto be checked for the presence of any elements in valuesToFind.valuesToFind- The values to be checked for their presence in the {givenCollection.- Returns:
trueif the givenCollectioncontains any elements invaluesToFind,falseotherwise if doesn't or if the givenCollectionisnullor empty, or if the specifiedvaluesToFindisnullor empty.
-
containsAny
Checks if the givenIterablecontains any elements from the specifiedvaluesToFindSet.- Parameters:
c- TheIterableto be checked for the presence of any elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenIterable.- Returns:
trueif the givenIterablecontains any elements invaluesToFind,falseotherwise if doesn't or if the givenIterableisnullor empty, or if the specifiedvaluesToFindisnullor empty.
-
containsAny
Checks if the givenIteratorcontains any elements from the specifiedvaluesToFindSet.- Parameters:
iter- TheIteratorto be checked for the presence of any elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenIterator.- Returns:
trueif the givenIteratorcontains any elements invaluesToFind,falseotherwise if doesn't or if the givenIteratorisnullor empty, or if the specifiedvaluesToFindisnullor empty.
-
containsNone
Checks if the givenCollectiondosn't contain any elements from the specifiedvaluesToFindCollection.- Parameters:
c- TheCollectionto be checked for the presence of any elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenCollection.- Returns:
trueif the givenCollectiondosn't contain any elements invaluesToFindor if the givenCollectionisnullor empty, or if the specifiedvaluesToFindisnullor empty,falseotherwise
-
containsNone
Checks if the specified givenCollectiondosn't contain any elements from the specifiedvaluesToFindarray.- Parameters:
c- TheCollectionto be checked for the presence of any elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenCollection.- Returns:
trueif the givenCollectiondosn't contain any elements invaluesToFindor if the givenCollectionisnullor empty, or if the specifiedvaluesToFindisnullor empty,falseotherwise
-
containsNone
Checks if the givenIterabledosn't contain any elements from the specifiedvaluesToFindSet.- Parameters:
c- TheIterableto be checked for the presence of any elements in valuesToFind.valuesToFind- The values to be checked for their presence in givenIterable.- Returns:
trueif the givenIterabledosn't contain any elements invaluesToFindor if the givenIterableisnullor empty, or if the specifiedvaluesToFindisnullor empty,falseotherwise
-
containsNone
Checks if the givenIteratordosn't contain any elements from the specifiedvaluesToFindSet.- Parameters:
iter- TheIteratorto be checked for the presence of any elements in valuesToFind.valuesToFind- The values to be checked for their presence in the givenIterator.- Returns:
trueif the givenIteratordosn't contain any elements invaluesToFindor if the givenIteratorisnullor empty, or if the specifiedvaluesToFindisnullor empty,falseotherwise
-
slice
public static <T> ImmutableList<T> slice(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a read-only slice of the input array from the specified start index to the end index.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The input array to be sliced.fromIndex- The start index for the slice, inclusive.toIndex- The end index for the slice, exclusive.- Returns:
- An ImmutableList containing the slice of the input array.
- Throws:
IndexOutOfBoundsException- if the fromIndex is negative, toIndex is larger than the length of the array, or fromIndex is larger than toIndex.
-
slice
public static <T> ImmutableList<T> slice(List<? extends T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a read-only slice of the input list from the specified start index to the end index.- Type Parameters:
T- The type of the elements in the list.- Parameters:
c- The input list to be sliced.fromIndex- The start index for the slice, inclusive.toIndex- The end index for the slice, exclusive.- Returns:
- An ImmutableList containing the slice of the input list.
- Throws:
IndexOutOfBoundsException- if the fromIndex is negative, toIndex is larger than the length of the list, or fromIndex is larger than toIndex.
-
slice
public static <T> ImmutableCollection<T> slice(Collection<? extends T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a read-only slice of the input collection from the specified start index to the end index.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The input collection to be sliced.fromIndex- The start index for the slice, inclusive.toIndex- The end index for the slice, exclusive.- Returns:
- An ImmutableCollection containing the slice of the input collection.
- Throws:
IndexOutOfBoundsException- if the fromIndex is negative, toIndex is larger than the size of the collection, or fromIndex is larger than toIndex.
-
slice
Returns a read-only slice of the input iterator from the specified start index to the end index.- Type Parameters:
T- The type of the elements in the iterator.- Parameters:
iter- The input iterator to be sliced.fromIndex- The start index for the slice, inclusive.toIndex- The end index for the slice, exclusive.- Returns:
- An ObjIterator containing the slice of the input iterator.
- Throws:
IllegalArgumentException- if the fromIndex is negative, or fromIndex is larger than toIndex.- See Also:
-
split
Splits the input boolean array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a- The input boolean array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of boolean sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static List<boolean[]> split(boolean[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input boolean array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input boolean array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of boolean sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
Splits the input char array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a- The input char array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of char sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static List<char[]> split(char[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input char array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input char array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of char sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
Splits the input byte array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a- The input byte array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of byte sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static List<byte[]> split(byte[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input byte array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input byte array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of byte sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
Splits the input short array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a- The input short array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of short sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static List<short[]> split(short[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input short array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input short array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of short sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
Splits the input int array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a- The input int array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of int sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static List<int[]> split(int[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input int array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input int array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of int sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
Splits the input long array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a- The input long array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of long sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static List<long[]> split(long[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input long array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input long array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of long sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
Splits the input float array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a- The input float array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of float sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static List<float[]> split(float[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input float array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input float array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of float sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
Splits the input double array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Parameters:
a- The input double array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of double sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static List<double[]> split(double[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input double array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input double array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of double sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
Splits the input array into sub-arrays of the specified size. The last sub-array may be smaller if the total array length is not a multiple of chunkSize.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The input array to be split.chunkSize- The desired size of each sub-array.- Returns:
- A list of sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static <T> List<T[]> split(T[] a, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input array into sub-arrays of the specified size. The last sub-array may be smaller if the length of specified range is not a multiple of chunkSize. The sub-arrays are created from the specified range in the input array.- Parameters:
a- The input array to be split.fromIndex- The start index for the slice of the array to be split, inclusive.toIndex- The end index for the slice of the array to be split, exclusive.chunkSize- The desired size of each sub-array.- Returns:
- A list of sub-arrays, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is larger than the length of array
-
split
public static <T> List<List<T>> split(Collection<? extends T> c, int chunkSize) throws IllegalArgumentException Splits the input collection into sub-collections of the specified size. The last sub-collection may be smaller if the total collection size is not a multiple of chunkSize.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The input collection to be split.chunkSize- The desired size of each sub-collection.- Returns:
- A list of sub-collections, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static <T> List<List<T>> split(Collection<? extends T> c, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Splits the input collection into sub-collections of the specified size. The last sub-collection may be smaller if the length of specified range is not a multiple of chunkSize. The sub-collections are created from the specified range in the input collection.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The input collection to be split.fromIndex- The start index for the slice of the collection to be split, inclusive.toIndex- The end index for the slice of the collection to be split, exclusive.chunkSize- The desired size of each sub-collection.- Returns:
- A list of sub-collections, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is greater than the size of collection.
-
split
public static <T> List<List<T>> split(Iterable<? extends T> c, int chunkSize) throws IllegalArgumentException Splits the input iterable into sub-collections of the specified size. The last sub-collection may be smaller if the total iterable size is not a multiple of chunkSize.- Type Parameters:
T- The type of the elements in the iterable.- Parameters:
c- The input iterable to be split.chunkSize- The desired size of each sub-collection.- Returns:
- A list of sub-collections, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
public static <T> ObjIterator<List<T>> split(Iterator<? extends T> iter, int chunkSize) throws IllegalArgumentException Splits the input iterator into sub-collections of the specified size. The last sub-collection may be smaller if the total iterator size is not a multiple of chunkSize.- Type Parameters:
T- The type of the elements in the iterator.- Parameters:
iter- The input iterator to be split.chunkSize- The desired size of each sub-collection.- Returns:
- An iterator of sub-collections, each of size chunkSize (except possibly for the last one).
- Throws:
IllegalArgumentException- if chunkSize is not a positive integer.
-
split
Returns consecutive substring of the specified string, each of the same length (the final list may be smaller), or an empty array if the specified string isnullor empty.- Parameters:
str-chunkSize- the desired size of each sub String (the last may be smaller).- Returns:
- Throws:
IllegalArgumentException
-
split
public static List<String> split(CharSequence str, int fromIndex, int toIndex, int chunkSize) throws IllegalArgumentException, IndexOutOfBoundsException Returns consecutive substring of the specified string, each of the same length (the final list may be smaller), or an empty array if the specified string isnullor empty.- Parameters:
str-fromIndex-toIndex-chunkSize- the desired size of each sub String (the last may be smaller).- Returns:
- Throws:
IllegalArgumentExceptionIndexOutOfBoundsException
-
splitByChunkCount
public static <T> List<T> splitByChunkCount(int totalSize, int maxChunkCount, IntBiFunction<? extends T> func) Splits the total size into chunks based on the specified maximum chunk count.
The size of the chunks is larger first.
The size of returned List may be less than the specifiedmaxChunkCountif the inputtotalSizeis less thanmaxChunkCount.- Type Parameters:
T- the type of the elements in the resulting stream- Parameters:
totalSize- the total size to be split. It could be the size of an array, list, etc.maxChunkCount- the maximum number of chunks to split intomapper- a function to map the chunk from and to index to an element in the resulting stream- Returns:
- a Stream of the mapped chunk values
- Throws:
IllegalArgumentException- iftotalSizeis negative ormaxChunkCountis not positive.- See Also:
-
splitByChunkCount
public static <T> List<T> splitByChunkCount(int totalSize, int maxChunkCount, boolean sizeSmallerFirst, IntBiFunction<? extends T> func) Splits the total size into chunks based on the specified maximum chunk count.
The size of the chunks can be either smaller or larger first based on the flag.
The size of returned List may be less than the specifiedmaxChunkCountif the inputtotalSizeis less thanmaxChunkCount.final int[] a = Array.rangeClosed(1, 7); splitByChunkCount(7, 5, true, (fromIndex, toIndex) -> copyOfRange(a, fromIndex, toIndex)); // [[1], [2], [3], [4, 5], [6, 7]] splitByChunkCount(7, 5, false, (fromIndex, toIndex) -> copyOfRange(a, fromIndex, toIndex)); // [[1, 2], [3, 4], [5], [6], [7]]- Type Parameters:
T- the type of the elements in the resulting stream- Parameters:
totalSize- the total size to be split. It could be the size of an array, list, etc.maxChunkCount- the maximum number of chunks to split intosizeSmallerFirst- iftrue, smaller chunks will be created first; otherwise, larger chunks will be created firstmapper- a function to map the chunk from and to index to an element in the resulting stream- Returns:
- a Stream of the mapped chunk values
- Throws:
IllegalArgumentException- iftotalSizeis negative ormaxChunkCountis not positive.- See Also:
-
splitByChunkCount
Splits the input collection into sub-lists based on the specified maximum chunk count.
The size of the chunks is larger first.
The size of returned List may be less than the specifiedmaxChunkCountif the input Collection size is less thanmaxChunkCount.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the input collection to be splitmaxChunkCount- the maximum number of chunks to split into- Returns:
- a list of sub-lists.
- Throws:
IllegalArgumentException- ifmaxChunkCountis not positive.- See Also:
-
splitByChunkCount
public static <T> List<List<T>> splitByChunkCount(Collection<? extends T> c, int maxChunkCount, boolean sizeSmallerFirst) Splits the input collection into sub-lists based on the specified maximum chunk count.
The size of the chunks can be either smaller or larger first based on the flag.
The size of returned List may be less than the specifiedmaxChunkCountif the input Collection size is less thanmaxChunkCount.final Listc = N.asList(1, 2, 3, 4, 5, 6, 7); splitByChunkCount(c, 5, true); // [[1], [2], [3], [4, 5], [6, 7]] splitByChunkCount(c, 5, false); // [[1, 2], [3, 4], [5], [6], [7]] - Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the input collection to be splitmaxChunkCount- the maximum number of chunks to split intosizeSmallerFirst- iftrue, smaller chunks will be created first; otherwise, larger chunks will be created first- Returns:
- a list of sub-lists.
- Throws:
IllegalArgumentException- ifmaxChunkCountis not positive.- See Also:
-
concat
public static boolean[] concat(boolean[] a, boolean[] b) Concatenates two boolean arrays into a new array.- Parameters:
a- The first boolean array.b- The second boolean array.- Returns:
- A new boolean array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned.
-
concat
Concatenates multiple boolean arrays into a new array.- Parameters:
aa- The boolean arrays to be concatenated.- Returns:
- A new boolean array that contains the elements of each array in
'aa'in the same order. If'aa'is empty ornull, an empty array is returned. If'aa'contains only one array, a clone of this array is returned.
-
concat
public static char[] concat(char[] a, char[] b) Concatenates two char arrays into a new array.- Parameters:
a- The first char array.b- The second char array.- Returns:
- A new char array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned.
-
concat
Concatenates multiple char arrays into a new array.- Parameters:
aa- The char arrays to be concatenated.- Returns:
- A new char array that contains the elements of each array in
'aa'in the same order. If'aa'is empty ornull, an empty array is returned. If'aa'contains only one array, a clone of this array is returned.
-
concat
public static byte[] concat(byte[] a, byte[] b) Concatenates two byte arrays into a new array.- Parameters:
a- The first byte array.b- The second byte array.- Returns:
- A new byte array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned.
-
concat
Concatenates multiple byte arrays into a new array.- Parameters:
aa- The byte arrays to be concatenated.- Returns:
- A new byte array that contains the elements of each array in
'aa'in the same order. If'aa'is empty ornull, an empty array is returned. If'aa'contains only one array, a clone of this array is returned.
-
concat
public static short[] concat(short[] a, short[] b) Concatenates two short arrays into a new array.- Parameters:
a- The first short array.b- The second short array.- Returns:
- A new short array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned.
-
concat
Concatenates multiple short arrays into a new array.- Parameters:
aa- The short arrays to be concatenated.- Returns:
- A new short array that contains the elements of each array in
'aa'in the same order. If'aa'is empty ornull, an empty array is returned. If'aa'contains only one array, a clone of this array is returned.
-
concat
public static int[] concat(int[] a, int[] b) Concatenates two int arrays into a new array.- Parameters:
a- The first int array.b- The second int array.- Returns:
- A new int array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned.
-
concat
Concatenates multiple int arrays into a new array.- Parameters:
aa- The int arrays to be concatenated.- Returns:
- A new int array that contains the elements of each array in
'aa'in the same order. If'aa'is empty ornull, an empty array is returned. If'aa'contains only one array, a clone of this array is returned.
-
concat
public static long[] concat(long[] a, long[] b) Concatenates two long arrays into a new array.- Parameters:
a- The first long array.b- The second long array.- Returns:
- A new long array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned.
-
concat
Concatenates multiple long arrays into a new array.- Parameters:
aa- The long arrays to be concatenated.- Returns:
- A new long array that contains the elements of each array in
'aa'in the same order. If'aa'is empty ornull, an empty array is returned. If'aa'contains only one array, a clone of this array is returned.
-
concat
public static float[] concat(float[] a, float[] b) Concatenates two float arrays into a new array.- Parameters:
a- The first float array.b- The second float array.- Returns:
- A new float array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned.
-
concat
Concatenates multiple float arrays into a new array.- Parameters:
aa- The float arrays to be concatenated.- Returns:
- A new float array that contains the elements of each array in
'aa'in the same order. If'aa'is empty ornull, an empty array is returned. If'aa'contains only one array, a clone of this array is returned.
-
concat
public static double[] concat(double[] a, double[] b) Concatenates two double arrays into a new array.- Parameters:
a- The first double array.b- The second double array.- Returns:
- A new double array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned.
-
concat
Concatenates multiple double arrays into a new array.- Parameters:
aa- The double arrays to be concatenated.- Returns:
- A new double array that contains the elements of each array in
'aa'in the same order. If'aa'is empty ornull, an empty array is returned. If'aa'contains only one array, a clone of this array is returned.
-
concat
public static <T> T[] concat(T[] a, T[] b) Concatenates two arrays into a new array.- Type Parameters:
T- The type of the elements in the arrays.- Parameters:
a- The first array.b- The second array.- Returns:
- A new array that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, a is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
concat
Concatenates multiple arrays into a new array.- Type Parameters:
T- The type of the elements in the arrays.- Parameters:
aa- The arrays to be concatenated.- Returns:
- A new array that contains the elements of each array in
'aa'in the same order. If all of the specified arrays arenull,nullis returned. - See Also:
-
concat
Concatenates two iterables into a new list.- Type Parameters:
T- The type of the elements in theiterables.- Parameters:
a- The first iterable.b- The second iterable.- Returns:
- A new list that contains the elements of a followed by the elements of b.
If both a and b are empty or
null, an empty list is returned. If a is empty ornull, a list containing the elements of b is returned. If b is empty ornull, a list containing the elements of a is returned. - See Also:
-
concat
Concatenates multiple iterables into a new list.- Type Parameters:
T- The type of the elements in theiterables.- Parameters:
a- The iterables to be concatenated.- Returns:
- A new list that contains the elements of each iterable in a in the same order.
If a is empty or
null, an empty list is returned. If a contains only one iterable, a list containing the elements of this iterable is returned. - See Also:
-
concat
Concatenates multiple iterables into a new list.- Type Parameters:
T- The type of the elements in theiterables.- Parameters:
c- The collection of iterable to be concatenated.- Returns:
- A new list that contains the elements of each iterable in c in the same order.
If c is empty or
null, an empty list is returned. If c contains only one iterable, a list containing the elements of this iterable is returned. - See Also:
-
concat
public static <T,C extends Collection<T>> C concat(Collection<? extends Iterable<? extends T>> c, IntFunction<? extends C> supplier) Concatenates multiple iterables into a new collection.- Type Parameters:
T- The type of the elements in theiterables.C- The type of the collection to be returned.- Parameters:
c- The collection of iterable to be concatenated.supplier- The function that generates a new instance of the return collection.- Returns:
- A new collection that contains the elements of each iterable in c in the same order.
The type of the returned collection is determined by the supplier function.
If c is empty or
null, an empty collection is returned. If c contains only one iterable, a collection containing the elements of this iterable is returned. - See Also:
-
concat
Concatenates two iterators into a new ObjIterator.- Type Parameters:
T- The type of the elements in the iterators.- Parameters:
a- The first iterator.b- The second iterator.- Returns:
- A new ObjIterator that contains the elements of a followed by the elements of b.
- See Also:
-
concat
Concatenates multiple iterators into a new ObjIterator.- Type Parameters:
T- The type of the elements in the iterators.- Parameters:
a- The array of iterators to be concatenated.- Returns:
- A new ObjIterator that contains the elements of each iterator in a in the same order.
- See Also:
-
flatten
public static boolean[] flatten(boolean[][] a) Flattens a two-dimensional boolean array into a one-dimensional boolean array.- Parameters:
a- The two-dimensional boolean array to be flattened.- Returns:
- A one-dimensional boolean array containing all elements in the input array.
Returns an empty array if the input array is
nullor empty.
-
flatten
public static char[] flatten(char[][] a) Flattens a two-dimensional char array into a one-dimensional char array.- Parameters:
a- The two-dimensional char array to be flattened.- Returns:
- A one-dimensional char array containing all elements in the input array.
Returns an empty array if the input array is
nullor empty.
-
flatten
public static byte[] flatten(byte[][] a) Flattens a two-dimensional byte array into a one-dimensional byte array.- Parameters:
a- The two-dimensional byte array to be flattened.- Returns:
- A one-dimensional byte array containing all elements in the input array.
Returns an empty array if the input array is
nullor empty.
-
flatten
public static short[] flatten(short[][] a) Flattens a two-dimensional short array into a one-dimensional short array.- Parameters:
a- The two-dimensional short array to be flattened.- Returns:
- A one-dimensional short array containing all elements in the input array.
Returns an empty array if the input array is
nullor empty.
-
flatten
public static int[] flatten(int[][] a) Flattens a two-dimensional int array into a one-dimensional int array.- Parameters:
a- The two-dimensional int array to be flattened.- Returns:
- A one-dimensional int array containing all elements in the input array.
Returns an empty array if the input array is
nullor empty.
-
flatten
public static long[] flatten(long[][] a) Flattens a two-dimensional long array into a one-dimensional long array.- Parameters:
a- The two-dimensional long array to be flattened.- Returns:
- A one-dimensional long array containing all elements in the input array.
Returns an empty array if the input array is
nullor empty.
-
flatten
public static float[] flatten(float[][] a) Flattens a two-dimensional float array into a one-dimensional float array.- Parameters:
a- The two-dimensional float array to be flattened.- Returns:
- A one-dimensional float array containing all elements in the input array.
Returns an empty array if the input array is
nullor empty.
-
flatten
public static double[] flatten(double[][] a) Flattens a two-dimensional double array into a one-dimensional double array.- Parameters:
a- The two-dimensional double array to be flattened.- Returns:
- A one-dimensional double array containing all elements in the input array.
Returns an empty array if the input array is
nullor empty.
-
flatten
Flattens a two-dimensional array into a one-dimensional array.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The two-dimensional array to be flattened.- Returns:
- A one-dimensional array containing all elements in the input array. Returns
nullif the input array isnull.
-
flatten
Flattens a two-dimensional array into a one-dimensional array.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The two-dimensional array to be flattened.componentType- The class object representing the component type of the new array.- Returns:
- A one-dimensional array containing all elements in the input array.
Returns an empty array if the input array is
null.
-
flatten
Flattens anIterableofIterable<T>into a one-dimensional List.- Type Parameters:
T- The type of the elements in theIterable.- Parameters:
c- The two-dimensionalIterableto be flattened.- Returns:
- A one-dimensional List containing all elements in the input
Iterable. Returns an empty List if the inputIterableisnullor empty.
-
flatten
public static <T,C extends Collection<T>> C flatten(Iterable<? extends Iterable<? extends T>> c, IntFunction<? extends C> supplier) Flattens anIterableofIterable<T>into a one-dimensional Collection.- Type Parameters:
T- The type of the elements in theIterable.C- The type of the Collection to be returned.- Parameters:
c- The two-dimensionalIterableto be flattened.supplier- The function that generates the Collection instance.- Returns:
- A one-dimensional Collection containing all elements in the input
Iterable. Returns an empty Collection if the inputIterableisnullor empty.
-
flatten
Flattens anIteratorofIterator<T>into a one-dimensional Iterator.- Type Parameters:
T- The type of the elements in the Iterator.- Parameters:
iters- The two-dimensional Iterator to be flattened.- Returns:
- A one-dimensional Iterator containing all elements in the input
Iterator. Returns an empty Iterator if the inputIteratorisnull.
-
flattenEachElement
Flattens each element of the providedIterableif it's anIterableitself, otherwise just adds it to the result List. This method is marked as Beta and may be subject to changes or removal in future versions.- Parameters:
c- TheIterableto be processed. Each element is checked if it's anIterableand flattened if so.- Returns:
- A List containing the flattened elements of the input
Iterable. If the inputIterableisnull, an empty List is returned.
-
flattenEachElement
@Beta public static <T,C extends Collection<T>> C flattenEachElement(Iterable<?> c, Supplier<? extends C> supplier) Flattens each element of the providedIterableif it's anIterableitself, otherwise just adds it to the result Collection. This method is marked as Beta and may be subject to changes or removal in future versions.- Type Parameters:
T- The type of the elements in theIterable.C- The type of the Collection to be returned.- Parameters:
c- TheIterableto be processed. Each element is checked if it's anIterableand flattened if so.supplier- The function that generates the Collection instance.- Returns:
- A Collection containing the flattened elements of the input
Iterable. If the inputIterableisnull, an empty Collection is returned.
-
intersection
public static boolean[] intersection(boolean[] a, boolean[] b) Returns the elements in the specified boolean arrays a and b that are present in both arrays. Occurrences are considered.- Parameters:
a- The first boolean array.b- The second boolean array.- Returns:
- A new boolean array containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty array is returned. - See Also:
-
intersection
public static char[] intersection(char[] a, char[] b) Returns the elements in the specified char arrays a and b that are present in both arrays. Occurrences are considered.- Parameters:
a- The first char array.b- The second char array.- Returns:
- A new char array containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty array is returned. - See Also:
-
intersection
public static byte[] intersection(byte[] a, byte[] b) Returns the elements in the specified byte arrays a and b that are present in both arrays. Occurrences are considered.- Parameters:
a- The first byte array.b- The second byte array.- Returns:
- A new byte array containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty array is returned. - See Also:
-
intersection
public static short[] intersection(short[] a, short[] b) Returns the elements in the specified short arrays a and b that are present in both arrays. Occurrences are considered.- Parameters:
a- The first short array.b- The second short array.- Returns:
- A new short array containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty array is returned. - See Also:
-
intersection
public static int[] intersection(int[] a, int[] b) Returns the elements in the specified int arrays a and b that are present in both arrays. Occurrences are considered.int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = retainAll(a, b); // The elements c in a will b: [1, 2, 2]. int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = intersection(a, b); // The elements c in a will b: [1, 2].- Parameters:
a- The first int array.b- The second int array.- Returns:
- A new int array containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty array is returned.
-
intersection
public static long[] intersection(long[] a, long[] b) Returns the elements in the specified long arrays a and b that are present in both arrays. Occurrences are considered.- Parameters:
a- The first long array.b- The second long array.- Returns:
- A new long array containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty array is returned. - See Also:
-
intersection
public static float[] intersection(float[] a, float[] b) Returns the elements in the specified float arrays a and b that are present in both arrays. Occurrences are considered.- Parameters:
a- The first float array.b- The second float array.- Returns:
- A new float array containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty array is returned. - See Also:
-
intersection
public static double[] intersection(double[] a, double[] b) Returns the elements in the specified double arrays a and b that are present in both arrays. Occurrences are considered.- Parameters:
a- The first double array.b- The second double array.- Returns:
- A new double array containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty array is returned. - See Also:
-
intersection
Returns the elements in the specified arrays a and b that are present in both arrays. Occurrences are considered.- Type Parameters:
T- The type of the elements in the input array.- Parameters:
a- The first array.b- The second array.- Returns:
- A new list containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty list is returned. - See Also:
-
intersection
Returns the elements in the specified collections a and b that are present in both collections. Occurrences are considered.- Type Parameters:
T- the type of elements in the input collections- Parameters:
a- the first collectionb- the second collection- Returns:
- a list containing the elements that are present in both collections
If either a or b is empty or
null, an empty list is returned. - See Also:
-
intersection
Returns the elements that are present in all collections within the specified collection of collections. Occurrences are considered.- Type Parameters:
T- The type of the elements in the collections.- Parameters:
c- The collection of collections to find the intersection of.- Returns:
- A list containing the elements that are present in all collections within c.
If c is empty or
null, an empty list is returned. If c contains only one collection, a list containing the elements of this collection is returned. - See Also:
-
intersection
@Beta public static <T> List<T> intersection(Collection<? extends T> a, Collection<?> b, boolean ignoreOcurrences) Return only the elements in the first collection that are contained in the specified second collection.
IfignoreOcurrencesistrue, Occurrences are not considered.
Duplicated elements in the returned List will not be eliminated.List
a = N.asList(0, 1, 2, 2, 3); List b = N.asList(2, 5, 1); List c = N.intersection(a, b, false); // The elements c in a will b: [1, 2]. same as N.intersection(a, b). List d = N.intersection(a, b, true); // The elements c in a will b: [1, 2, 2]. - Type Parameters:
T- the type of elements in the input collections- Parameters:
a- the first collection, elements from this collection will be retainedb- the second collection, elements in this collection are to be retained in the first collectionignoreOcurrences- iftrue, the method does not consider the number of occurrences of an element.- Returns:
- a List the elements in the first collection that are contained in the specified second collection.
- See Also:
-
difference
public static boolean[] difference(boolean[] a, boolean[] b) Returns the elements in the specified boolean array a but not present in the boolean array b. Occurrences are considered.- Parameters:
a- The first boolean array.b- The second boolean array.- Returns:
- A new boolean array containing the elements that are present in a but not in b.
If a is empty or
null, an empty array is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
difference
public static char[] difference(char[] a, char[] b) Returns the elements in the specified char array a but not present in the char array b. Occurrences are considered.- Parameters:
a- The first char array.b- The second char array.- Returns:
- A new char array containing the elements that are present in a but not in b.
If a is empty or
null, an empty array is returned. If b is empty ornull, a clone of a is returned - See Also:
-
difference
public static byte[] difference(byte[] a, byte[] b) Returns the elements in the specified byte array a but not present in the byte array b. Occurrences are considered.- Parameters:
a- The first byte array.b- The second byte array.- Returns:
- A new byte array containing the elements that are present in a but not in b.
If a is empty or
null, an empty array is returned. If b is empty ornull, a clone of a is returned - See Also:
-
difference
public static short[] difference(short[] a, short[] b) Returns the elements in the specified short array a but not present in the short array b. Occurrences are considered.- Parameters:
a- The first short array.b- The second short array.- Returns:
- A new short array containing the elements that are present in a but not in b.
If a is empty or
null, an empty array is returned. If b is empty ornull, a clone of a is returned - See Also:
-
difference
public static int[] difference(int[] a, int[] b) Returns the elements in the specified int array a but not present in the int array b. Occurrences are considered.int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = removeAll(a, b); // The elements c in a will b: [0, 3]. int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = difference(a, b); // The elements c in a will b: [0, 2, 3].- Parameters:
a- The first int array.b- The second int array.- Returns:
- A new int array containing the elements that are present in a but not in b.
If a is empty or
null, an empty array is returned. If b is empty ornull, a clone of a is returned
-
difference
public static long[] difference(long[] a, long[] b) Returns the elements in the specified long array a but not present in the long array b. Occurrences are considered.- Parameters:
a- The first long array.b- The second long array.- Returns:
- A new long array containing the elements that are present in a but not in b.
If a is empty or
null, an empty array is returned. If b is empty ornull, a clone of a is returned - See Also:
-
difference
public static float[] difference(float[] a, float[] b) Returns the elements in the specified float array a but not present in the float array b. Occurrences are considered.- Parameters:
a- The first float array.b- The second float array.- Returns:
- A new float array containing the elements that are present in a but not in b.
If a is empty or
null, an empty array is returned. If b is empty ornull, a clone of a is returned - See Also:
-
difference
public static double[] difference(double[] a, double[] b) Returns the elements in the specified double array a but not present in the double array b. Occurrences are considered.- Parameters:
a- The first double array.b- The second double array.- Returns:
- A new double array containing the elements that are present in a but not in b.
If a is empty or
null, an empty array is returned. If b is empty ornull, a clone of a is returned - See Also:
-
difference
Returns the elements in the specified arrays a but not present in the specified array b. Occurrences are considered.- Type Parameters:
T- The type of the elements in the input array.- Parameters:
a- The first array.b- The second array.- Returns:
- A new list containing the elements that are present in a but not in b.
If a is empty or
null, an empty list is returned. If b is empty ornull, a clone of a is returned - See Also:
-
difference
Returns the elements in the specified collections a but not present in the specified collection b. Occurrences are considered.- Type Parameters:
T- The type of the elements in the collections.- Parameters:
a- The first collection.b- The second collection.- Returns:
- A new list containing the elements that are present in a but not in b.
If a is empty or
null, an empty list is returned. If b is empty ornull, a new list with all element from a is returned - See Also:
-
symmetricDifference
public static boolean[] symmetricDifference(boolean[] a, boolean[] b) Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Parameters:
a- The first boolean array.b- The second boolean array.- Returns:
- A new boolean array containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
symmetricDifference
public static char[] symmetricDifference(char[] a, char[] b) Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Parameters:
a- The first char array.b- The second char array.- Returns:
- A new char array containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
symmetricDifference
public static byte[] symmetricDifference(byte[] a, byte[] b) Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Parameters:
a- The first byte array.b- The second byte array.- Returns:
- A new byte array containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
symmetricDifference
public static short[] symmetricDifference(short[] a, short[] b) Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Parameters:
a- The first short array.b- The second short array.- Returns:
- A new short array containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
symmetricDifference
public static int[] symmetricDifference(int[] a, int[] b) Returns the elements that are present in either a or b but not in both. Occurrences are considered.int[] a = {0, 1, 2, 2, 3}; int[] b = {2, 5, 1}; int[] c = symmetricDifference(a, b); // The elements c in a will b: [0, 2, 3, 5].- Parameters:
a- The first int array.b- The second int array.- Returns:
- A new int array containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
symmetricDifference
public static long[] symmetricDifference(long[] a, long[] b) Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Parameters:
a- The first long array.b- The second long array.- Returns:
- A new long array containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
symmetricDifference
public static float[] symmetricDifference(float[] a, float[] b) Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Parameters:
a- The first float array.b- The second float array.- Returns:
- A new float array containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
symmetricDifference
public static double[] symmetricDifference(double[] a, double[] b) Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Parameters:
a- The first double array.b- The second double array.- Returns:
- A new double array containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty array is returned. If a is empty ornull, a clone of b is returned. If b is empty ornull, a clone of a is returned. - See Also:
-
symmetricDifference
Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Type Parameters:
T- The type of the elements in the arrays.- Parameters:
a- The first array.b- The second array.- Returns:
- A new list containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty list is returned. If a is empty ornull, a list containing the elements of b is returned. If b is empty ornull, a list containing the elements of a is returned. - See Also:
-
symmetricDifference
Returns the elements that are present in either a or b but not in both. Occurrences are considered.- Type Parameters:
T- The type of the elements in the collections.- Parameters:
a- The first collection.b- The second collection.- Returns:
- A new list containing the elements that are present in either a or b but not in both.
If both a and b are empty or
null, an empty list is returned. If a is empty ornull, a list containing the elements of b is returned. If b is empty ornull, a list containing the elements of a is returned. - See Also:
-
commonSet
Returns a set containing the common elements between the specified collections a and b.- Type Parameters:
T- The type of the elements in the collection a.- Parameters:
a- The first collection.b- The second collection.- Returns:
- A set containing the elements that are present in both a and b.
If either a or b is empty or
null, an empty set is returned. - See Also:
-
commonSet
Returns a set containing the common elements among all the collections within the specified collection of collections.- Type Parameters:
T- The type of the elements in the collections.- Parameters:
c- The collection of collections to find the common elements of.- Returns:
- A set containing the elements that are present in all collections within c.
If c is empty or
null, an empty set is returned. If c contains only one collection, a set containing the elements of this collection is returned. - See Also:
-
exclude
Returns a newListcontaining all the elements from the specified collection except all occurrences of specified objToExclude.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection from which to exclude the specified object.objToExclude- The object to exclude from the collection.- Returns:
- A new
Listwith the specified object excluded. If the collection c is empty ornull, an empty list is returned. - See Also:
-
excludeToSet
Returns a newSetcontaining all the elements from the specified collection except all occurrences of specified objToExclude.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection from which to exclude the specified object.objToExclude- The object to exclude from the collection.- Returns:
- A new
Setwith the specified object excluded. If the collection c is empty ornull, an empty set is returned. - See Also:
-
excludeAll
Returns a newListcontaining all the elements from the specified collection except all occurrences of elements in the specified objsToExclude. That's to say no more value from objsToExclude will present in the returnedSet.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection from which to exclude the specified objects.objsToExclude- The objects to exclude from the collection.- Returns:
- A new
Listwith the specified objects excluded. If the collection c is empty ornull, an empty list is returned. - See Also:
-
excludeAllToSet
Returns a newSetcontaining all the elements from the specified collection except all occurrences of elements in the specified objsToExclude. That's to say no more value from objsToExclude will present in the returnedSet.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection from which to exclude the specified objects.objsToExclude- The objects to exclude from the collection.- Returns:
- A new
Setwith the specified objects excluded. If the collection c is empty ornull, an empty set is returned. - See Also:
-
isSubCollection
public static boolean isSubCollection(@NotNull Collection<?> subColl, @NotNull Collection<?> coll) throws IllegalArgumentException Returnstrueif subColl is a sub-collection of coll, that is, if the cardinality of e in subColl is less than or equal to the cardinality of e in coll, for each element e in subColl.- Parameters:
subColl- the first (sub?) collection, must not be nullcoll- the second (super?) collection, must not be null- Returns:
trueif subColl is a sub-collection of coll- Throws:
IllegalArgumentException- ifsubCollorcollisnull- See Also:
-
isProperSubCollection
public static boolean isProperSubCollection(@NotNull Collection<?> subColl, @NotNull Collection<?> coll) throws IllegalArgumentException Returnstrueif subColl is a proper sub-collection of coll, that is, if the cardinality of e in subColl is less than or equal to the cardinality of e in coll, for each element e in subColl, and there is at least one element f such that the cardinality of f in coll is strictly greater than the cardinality of f in subColl.The implementation assumes
subColl.size()andcoll.size()represent the total cardinality of a and b, resp.subColl.size() < Integer.MAXVALUE
- Parameters:
subColl- the first (sub?) collection, must not be nullcoll- the second (super?) collection, must not be null- Returns:
trueif subColl is a proper sub-collection of coll- Throws:
IllegalArgumentException- ifsubCollorcollisnull- See Also:
-
isEqualCollection
Returnstrueif the givenCollections contain exactly the same elements with exactly the same cardinalities.That is, if the cardinality of e in a is equal to the cardinality of e in b, for each element e in a or b.
- Parameters:
a- the first collectionb- the second collection- Returns:
trueif the collections contain the same elements with the same cardinalities.
-
replaceIf
Replaces all elements in the given boolean array that satisfy the provided predicate with a specified boolean value.- Parameters:
a- The boolean array in which to replace values.predicate- The predicate used to determine which elements should be replaced.newValue- The boolean value to replace with if the predicate is satisfied.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given char array that satisfy the provided predicate with a specified char value.- Parameters:
a- The char array to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The char value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given byte array that satisfy the provided predicate with a specified byte value.- Parameters:
a- The byte array to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The byte value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given short array that satisfy the provided predicate with a specified short value.- Parameters:
a- The short array to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The short value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given int array that satisfy the provided predicate with a specified int value.- Parameters:
a- The int array to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The int value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given long array that satisfy the provided predicate with a specified long value.- Parameters:
a- The long array to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The long value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given float array that satisfy the provided predicate with a specified float value.- Parameters:
a- The float array to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The float value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given double array that satisfy the provided predicate with a specified double value.- Parameters:
a- The double array to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The double value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given array that satisfy the provided predicate with a specified value.- Type Parameters:
T- The type of elements in the array.- Parameters:
a- The array to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceIf
Replaces all elements in the given list that satisfy the provided predicate with a specified value.- Type Parameters:
T- The type of elements in the list.- Parameters:
list- The list to be modified.predicate- The predicate used to determine which elements should be replaced.newValue- The value to replace all elements that satisfy the predicate.- Returns:
- The number of replacements made. If the input list is empty or
null, zero is returned.
-
replaceAll
public static int replaceAll(boolean[] a, boolean oldVal, boolean newVal) Replaces all occurrences of the specified old value with the new value in the given boolean array.- Parameters:
a- The boolean array in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
public static int replaceAll(char[] a, char oldVal, char newVal) Replaces all occurrences of the specified old value with the new value in the given char array.- Parameters:
a- The char array in which replacements are to be made.oldVal- The char value to be replaced.newVal- The char value to replace all occurrences of the oldVal.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
public static int replaceAll(byte[] a, byte oldVal, byte newVal) Replaces all occurrences of the specified old value with the new value in the given byte array.- Parameters:
a- The byte array in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
public static int replaceAll(short[] a, short oldVal, short newVal) Replaces all occurrences of the specified old value with the new value in the given short array.- Parameters:
a- The short array in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
public static int replaceAll(int[] a, int oldVal, int newVal) Replaces all occurrences of the specified old value with the new value in the given int array.- Parameters:
a- The int array in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
public static int replaceAll(long[] a, long oldVal, long newVal) Replaces all occurrences of the specified old value with the new value in the given long array.- Parameters:
a- The long array in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
public static int replaceAll(float[] a, float oldVal, float newVal) Replaces all occurrences of the specified old value with the new value in the given float array.- Parameters:
a- The float array in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
public static int replaceAll(double[] a, double oldVal, double newVal) Replaces all occurrences of the specified old value with the new value in the given double array.- Parameters:
a- The double array in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
Replaces all occurrences of the specified old value with the new value in the given array.- Type Parameters:
T- The type of elements in the array.- Parameters:
a- The array in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input array is empty or
null, zero is returned.
-
replaceAll
Replaces all occurrences of the specified old value with the new value in the given list.- Type Parameters:
T- The type of elements in the list.- Parameters:
list- The list in which to replace values.oldVal- The value to be replaced.newVal- The value to replace with.- Returns:
- The number of replacements made. If the input list is empty or
null, zero is returned.
-
replaceAll
Replaces all elements in the given boolean array using the specifiedBooleanUnaryOperator. If the input array is empty ornull, no replacements are made.- Parameters:
a- The boolean array in which to replace values.operator- The BooleanUnaryOperator to apply to each element. The operator takes a boolean value and returns a boolean value.- See Also:
-
replaceAll
Replaces all elements in the given char array using the specifiedCharUnaryOperator. If the input array is empty ornull, no replacements are made.- Parameters:
a- The char array in which to replace values.operator- The CharUnaryOperator to apply to each element. The operator takes a char value and returns a char value.- See Also:
-
replaceAll
Replaces all elements in the given byte array using the specifiedByteUnaryOperator. If the input array is empty ornull, no replacements are made.- Parameters:
a- The byte array in which to replace values.operator- The ByteUnaryOperator to apply to each element. The operator takes a byte value and returns a byte value.- See Also:
-
replaceAll
Replaces all elements in the given short array using the specifiedShortUnaryOperator. If the input array is empty ornull, no replacements are made.- Parameters:
a- The short array in which to replace values.operator- The ShortUnaryOperator to apply to each element. The operator takes a short value and returns a short value.- See Also:
-
replaceAll
Replaces all elements in the given int array using the specifiedIntUnaryOperator. If the input array is empty ornull, no replacements are made.- Parameters:
a- The int array in which to replace values.operator- The IntUnaryOperator to apply to each element. The operator takes an int value and returns an int value.- See Also:
-
replaceAll
Replaces all elements in the given long array using the specifiedLongUnaryOperator. If the input array is empty ornull, no replacements are made.- Parameters:
a- The long array in which to replace values.operator- The LongUnaryOperator to apply to each element. The operator takes a long value and returns a long value.- See Also:
-
replaceAll
Replaces all elements in the given float array using the specifiedFloatUnaryOperator. If the input array is empty ornull, no replacements are made.- Parameters:
a- The float array in which to replace values.operator- The FloatUnaryOperator to apply to each element. The operator takes a float value and returns a float value.- See Also:
-
replaceAll
Replaces all elements in the given double array using the specifiedDoubleUnaryOperator. If the input array is empty ornull, no replacements are made.- Parameters:
a- The double array in which to replace values.operator- The DoubleUnaryOperator to apply to each element. The operator takes a double value and returns a double value.- See Also:
-
replaceAll
Replaces all elements in the given array using the specifiedUnaryOperator. If the input array is empty ornull, no replacements are made.- Type Parameters:
T- The type of elements in the array.- Parameters:
a- The array in which to replace values.operator- The UnaryOperator to apply to each element. The operator takes a value of type T and returns a value of type T.- See Also:
-
replaceAll
Replaces all elements in the given list using the specifiedUnaryOperator. If the input list is empty ornull, no replacements are made.- Type Parameters:
T- The type of elements in the list.- Parameters:
list- The list in which to replace values.operator- The UnaryOperator to apply to each element. The operator takes a value of type T and returns a value of type T.- See Also:
-
updateAllUsingReplaceAllInstead
@Deprecated public static void updateAllUsingReplaceAllInstead() throws UnsupportedOperationExceptionDeprecated.usereplaceAllA fake/unsupported method defined to remind user to usereplaceAllwhenupdate/updateAll/updateIfis searched.- Throws:
UnsupportedOperationException- See Also:
-
updateIfUsingReplaceIfInstead
Deprecated.usereplaceIfA fake/unsupported method defined to remind user to usereplaceIfwhenupdate/updateAll/updateIfis searched.- Throws:
UnsupportedOperationException- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given array using the provided generator function. If the specified array isnullor empty, does nothing.- Type Parameters:
T- the type of elements in the input array- Parameters:
array- the array to be modifiedgenerator- the function used to generate new values for the array elements- See Also:
-
setAll
Sets all elements in the given list using the provided generator function. If the specified list isnullor empty, does nothing.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be modifiedgenerator- the function used to generate new values for the list elements- See Also:
-
setAll
@Beta public static <T,E extends Exception> void setAll(T[] a, Throwables.IntObjFunction<? super T, ? extends T, throws EE> converter) Sets all elements in the given array using the provided converter function. If the specified array isnullor empty, does nothing.- Type Parameters:
T- the type of elements in the arrayE- the type of exception that the converter may throw- Parameters:
a- the array to be modifiedconverter- the function used to generate new values for the array elements with the index of the element as the first parameter and the original element as the second parameter- Throws:
E- if the converter function throws an exception- See Also:
-
setAll
@Beta public static <T,E extends Exception> void setAll(List<T> list, Throwables.IntObjFunction<? super T, ? extends T, throws EE> converter) Sets all elements in the given list using the provided converter function. If the specified list isnullor empty, does nothing.- Type Parameters:
T- the type of elements in the listE- the type of exception that the converter may throw- Parameters:
list- the list to be modifiedconverter- the function used to generate new values for the list elements with the index of the element as the first parameter and the original element as the second parameter- Throws:
E- if the converter function throws an exception- See Also:
-
copyThenSetAll
Creates a copy of the given array and sets all elements in the copy using the provided generator function. If the specified array isnull, returnsnull. If the specified array is empty, returns itself.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be copied and modifiedgenerator- the function used to generate new values for the array elements- Returns:
- a new array with elements copied from the specified array and modified by the generator function
- See Also:
-
copyThenSetAll
@MayReturnNull public static <T,E extends Exception> T[] copyThenSetAll(T[] a, Throwables.IntObjFunction<? super T, ? extends T, throws EE> converter) Creates a copy of the given array and sets all elements in the copy using the provided converter function. If the specified array isnull, returnsnull. If the specified array is empty, returns itself.- Type Parameters:
T- the type of elements in the arrayE- the type of exception that the converter may throw- Parameters:
a- the array to be copied and modifiedconverter- the function used to generate new values for the array elements with the index of the element as the first parameter and the original element as the second parameter- Returns:
- a new array with elements copied from the specified array and modified by the converter function
- Throws:
E- if the converter function throws an exception- See Also:
-
copyThenReplaceAll
Creates a copy of the given array and replaces all elements in the copy using the providedUnaryOperator. If the specified array isnull, returnsnull. If the specified array is empty, returns itself.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be copied and modifiedoperator- The UnaryOperator to apply to each element. The operator takes a value of type T and returns a value of type T.- Returns:
- a new array with elements copied from the specified array and modified by provided
UnaryOperator - See Also:
-
add
public static boolean[] add(boolean[] a, boolean elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original boolean array.elementToAdd- The boolean element to be added to the array.- Returns:
- A new boolean array containing the original elements and the added element.
-
add
public static char[] add(char[] a, char elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original char array.elementToAdd- The char element to be added to the array.- Returns:
- A new char array containing the original elements and the added element.
-
add
public static byte[] add(byte[] a, byte elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original byte array.elementToAdd- The byte element to be added to the array.- Returns:
- A new byte array containing the original elements and the added element.
-
add
public static short[] add(short[] a, short elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original short array.elementToAdd- The short element to be added to the array.- Returns:
- A new short array containing the original elements and the added element.
-
add
public static int[] add(int[] a, int elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original int array.elementToAdd- The int element to be added to the array.- Returns:
- A new int array containing the original elements and the added element.
-
add
public static long[] add(long[] a, long elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original long array.elementToAdd- The long element to be added to the array.- Returns:
- A new long array containing the original elements and the added element.
-
add
public static float[] add(float[] a, float elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original float array.elementToAdd- The float element to be added to the array.- Returns:
- A new float array containing the original elements and the added element.
-
add
public static double[] add(double[] a, double elementToAdd) Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original double array.elementToAdd- The double element to be added to the array.- Returns:
- A new double array containing the original elements and the added element.
-
add
Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The original String array.elementToAdd- The String element to be added to the array.- Returns:
- A new String array containing the original elements and the added element.
-
add
Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Type Parameters:
T- The type of elements in the array.- Parameters:
a- The original array.elementToAdd- The element to be added to the array.- Returns:
- A new array containing the original elements and the added element.
- Throws:
IllegalArgumentException- if the original array isnull.
-
addAll
Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new boolean array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified element added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new char array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new byte array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new short array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new int array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new long array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new float array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new double array containing the elements from a and elementsToAdd.
-
addAll
Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Parameters:
a- The first array whose elements are added to the new array.elementsToAdd- The additional elements to be added to the new array.- Returns:
- A new String array containing the elements from a and elementsToAdd.
-
addAll
@SafeVarargs public static <T> T[] addAll(@NotNull T[] a, T... elementsToAdd) throws IllegalArgumentException Returns a new array with elements copied from the specified array and the specified elements added at the end.
The original array remains unchanged.- Type Parameters:
T- The type of elements in the array.- Parameters:
a- The original array.elementsToAdd- The elements to be added to the array.- Returns:
- A new array containing the original elements and the added elements.
- Throws:
IllegalArgumentException- if the input array a and elementsToAdd both arenull.
-
addAll
public static <T> boolean addAll(@NotNull Collection<T> c, T... elementsToAdd) throws IllegalArgumentException Adds all the elements in elementsToAdd to the given collection.- Type Parameters:
T- The type of elements in the collection.- Parameters:
c- The original collection.elementsToAdd- The elements to be added to the collection.- Returns:
- A boolean indicating if the collection changed as a result of the call.
- Throws:
IllegalArgumentException- if the original collection isnull.
-
addAll
public static <T> boolean addAll(@NotNull Collection<T> c, Iterable<? extends T> elementsToAdd) throws IllegalArgumentException Adds all the elements in elementsToAdd to the given collection.- Type Parameters:
T- The type of elements in the collection.- Parameters:
c- The original collection where elements are to be added.elementsToAdd- The collection of elements to be added to the original collection.- Returns:
- A boolean indicating if the original collection changed as a result of the call.
- Throws:
IllegalArgumentException- if the original collection isnull.
-
addAll
public static <T> boolean addAll(@NotNull Collection<T> c, Iterator<? extends T> elementsToAdd) throws IllegalArgumentException Adds all the elements in elementsToAdd to the given collection.- Type Parameters:
T- The type of elements in the collection.- Parameters:
c- The original collection where elements are to be added.elementsToAdd- The iterator of elements to be added to the original collection.- Returns:
- A boolean indicating if the original collection changed as a result of the call.
- Throws:
IllegalArgumentException- if the original collection isnull.
-
insert
public static boolean[] insert(boolean[] a, int index, boolean elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original boolean arrayindex- the position in the array where the new element should be insertedelementToInsert- the char value to be inserted into the array- Returns:
- a new char array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static char[] insert(char[] a, int index, char elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original char arrayindex- the position in the array where the new element should be insertedelementToInsert- the boolean value to be inserted into the array- Returns:
- a new boolean array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static byte[] insert(byte[] a, int index, byte elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original byte arrayindex- the position in the array where the new element should be insertedelementToInsert- the byte value to be inserted into the array- Returns:
- a new byte array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static short[] insert(short[] a, int index, short elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original short arrayindex- the position in the array where the new element should be insertedelementToInsert- the short value to be inserted into the array- Returns:
- a new short array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static int[] insert(int[] a, int index, int elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original int arrayindex- the position in the array where the new element should be insertedelementToInsert- the int value to be inserted into the array- Returns:
- a new int array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static long[] insert(long[] a, int index, long elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original long arrayindex- the position in the array where the new element should be insertedelementToInsert- the long value to be inserted into the array- Returns:
- a new long array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static float[] insert(float[] a, int index, float elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original float arrayindex- the position in the array where the new element should be insertedelementToInsert- the float value to be inserted into the array- Returns:
- a new float array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static double[] insert(double[] a, int index, double elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original double arrayindex- the position in the array where the new element should be insertedelementToInsert- the double value to be inserted into the array- Returns:
- a new double array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static String[] insert(String[] a, int index, String elementToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original String arrayindex- the position in the array where the new element should be insertedelementToInsert- the String value to be inserted into the array- Returns:
- a new String array with the original elements and the inserted element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static <T> T[] insert(@NotNull T[] a, int index, T elementToInsert) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified element inserted at the specified index.
The original array remains unchanged.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the original arrayindex- the position in the array where the new element should be insertedelementToInsert- the element to be inserted into the array- Returns:
- a new array with the original elements and the inserted element
- Throws:
IllegalArgumentException- if the original array isnullIndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insert
public static String insert(String str, int index, String strToInsert) throws IndexOutOfBoundsException Returns a new String with chars copied from the specified String and the specified String inserted at the specified index.
The original String remains unchanged.- Parameters:
str- the original stringindex- the position in the string where the new string should be insertedstrToInsert- the string to be inserted into the original string- Returns:
- a new string with the original characters and the inserted string
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > str.length())
-
insertAll
@SafeVarargs public static boolean[] insertAll(boolean[] a, int index, boolean... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static char[] insertAll(char[] a, int index, char... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static byte[] insertAll(byte[] a, int index, byte... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static short[] insertAll(short[] a, int index, short... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static int[] insertAll(int[] a, int index, int... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static long[] insertAll(long[] a, int index, long... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static float[] insertAll(float[] a, int index, float... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static double[] insertAll(double[] a, int index, double... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static String[] insertAll(String[] a, int index, String... elementsToInsert) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static <T> T[] insertAll(@NotNull T[] a, int index, T... elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array and the specified elements inserted at the specified index.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position in the array where the new elements should be insertedelementsToInsert- the elements to be inserted into the array- Returns:
- a new array with the original elements and the inserted elements
- Throws:
IllegalArgumentException- if the specifiedArrayisnull.IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > a.length)
-
insertAll
@SafeVarargs public static <T> boolean insertAll(@NotNull List<T> list, int index, T... elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException Inserts the specified elements at the specified position in the list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to insert intoindex- the position in the list where the new elements should be insertedelementsToInsert- the elements to be inserted into the list- Returns:
trueif the list changed as a result of the call- Throws:
IllegalArgumentException- if the list isnullIndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > list.size())
-
insertAll
public static <T> boolean insertAll(@NotNull List<T> list, int index, Collection<? extends T> elementsToInsert) throws IllegalArgumentException, IndexOutOfBoundsException Inserts the specified elements at the specified position in the list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to insert intoindex- the position in the list where the new elements should be insertedelementsToInsert- the elements to be inserted into the list- Returns:
trueif the list changed as a result of the call- Throws:
IllegalArgumentException- if the list isnullIndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index > list.size())
-
deleteByIndex
public static boolean[] deleteByIndex(@NotNull boolean[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original boolean arrayindex- the position of the element to be removed- Returns:
- a new boolean array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteByIndex
public static char[] deleteByIndex(@NotNull char[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original char arrayindex- the position of the element to be removed- Returns:
- a new char array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteByIndex
public static byte[] deleteByIndex(@NotNull byte[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original byte arrayindex- the position of the element to be removed- Returns:
- a new byte array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteByIndex
public static short[] deleteByIndex(@NotNull short[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original short arrayindex- the position of the element to be removed- Returns:
- a new short array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteByIndex
public static int[] deleteByIndex(@NotNull int[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original int arrayindex- the position of the element to be removed- Returns:
- a new int array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteByIndex
public static long[] deleteByIndex(@NotNull long[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original long arrayindex- the position of the element to be removed- Returns:
- a new long array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteByIndex
public static float[] deleteByIndex(@NotNull float[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original float arrayindex- the position of the element to be removed- Returns:
- a new float array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteByIndex
public static double[] deleteByIndex(@NotNull double[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original double arrayindex- the position of the element to be removed- Returns:
- a new double array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteByIndex
public static <T> T[] deleteByIndex(@NotNull T[] a, int index) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the element at the specified position.
The original array remains unchanged.- Parameters:
a- the original arrayindex- the position of the element to be removed- Returns:
- a new array containing the existing elements except the element at the specified index
- Throws:
IndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= a.length)IllegalArgumentException
-
deleteAllByIndices
@SafeVarargs public static boolean[] deleteAllByIndices(boolean[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input boolean array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new boolean array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static char[] deleteAllByIndices(char[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input char array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new char array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static byte[] deleteAllByIndices(byte[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input byte array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new byte array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static short[] deleteAllByIndices(short[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input short array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new short array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static int[] deleteAllByIndices(int[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input int array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new int array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static long[] deleteAllByIndices(long[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input long array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new long array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static float[] deleteAllByIndices(float[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input float array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new float array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static double[] deleteAllByIndices(double[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input double array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new double array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static String[] deleteAllByIndices(String[] a, int... indices) throws IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Parameters:
a- the input String array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new String array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's range
-
deleteAllByIndices
@SafeVarargs public static <T> T[] deleteAllByIndices(@NotNull T[] a, int... indices) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with elements copied from the specified array except the elements at the specified positions.
The original array remains unchanged.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input array from which elements are to be removedindices- the positions of the elements to be removed- Returns:
- a new array containing the remaining elements after removal
- Throws:
IndexOutOfBoundsException- if any index is out of the array's rangeIllegalArgumentException
-
deleteAllByIndices
@SafeVarargs public static boolean deleteAllByIndices(@NotNull List<?> list, int... indices) throws IllegalArgumentException Deletes all elements at the specified positions from the given list.- Parameters:
list- The list from which elements are to be removed.indices- The positions of the elements to be removed.- Returns:
trueif the list was modified as a result of the operation,falseotherwise.- Throws:
IllegalArgumentException- if the input list isnull.
-
remove
public static boolean[] remove(boolean[] a, boolean valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
public static char[] remove(char[] a, char valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
public static byte[] remove(byte[] a, byte valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
public static short[] remove(short[] a, short valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
public static int[] remove(int[] a, int valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
public static long[] remove(long[] a, long valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
public static float[] remove(float[] a, float valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
public static double[] remove(double[] a, double valueToRemove) Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
remove
Returns a new array with elements copied from the specified array except the first occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. The input array itself is returned if the specified array is
nullor empty. - Throws:
IllegalArgumentException
-
remove
Removes the first occurrence of the specified value from the given collection.- Parameters:
c- The collection from which the value should be removed.valueToRemove- The value to be removed from the collection.- Returns:
trueif the collection changed as a result of this call,falseotherwise.
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with all occurrences of the specified values removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Returns a new array with elements copied from the specified array except all occurrences of the specified values.
The original array remains unchanged.- Parameters:
a- The array from which the values should be removed.valuesToRemove- The values to be removed from the array.- Returns:
- A new array with the first occurrence of the specified value removed. The input array itself is returned if the specified array is
nullor empty. - See Also:
-
removeAll
Removes all occurrences of the specified values from the given collection.- Type Parameters:
T- The type of elements in the collection.- Parameters:
c- The collection from which the values should be removed.valuesToRemove- The values to be removed from the collection.- Returns:
trueif the collection changed as a result of this call,falseotherwise.
-
removeAll
Removes all occurrences of the specified values from the given collection.- Type Parameters:
T- The type of elements in the collection.- Parameters:
c- The collection from which the values should be removed.valuesToRemove- The collection of values to be removed from the collection.- Returns:
trueif the collection changed as a result of this call,falseotherwise.
-
removeAll
Removes all occurrences of the specified values from the given collection.- Type Parameters:
T- The type of elements in the collection.- Parameters:
c- The collection from which the elements should be removed.valuesToRemove- The iterator of values to be removed from the collection.- Returns:
trueif the collection changed as a result of this call,falseotherwise.
-
removeAllOccurrences
public static boolean[] removeAllOccurrences(boolean[] a, boolean valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
public static char[] removeAllOccurrences(char[] a, char valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
public static byte[] removeAllOccurrences(byte[] a, byte valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
public static short[] removeAllOccurrences(short[] a, short valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
public static int[] removeAllOccurrences(int[] a, int valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
public static long[] removeAllOccurrences(long[] a, long valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
public static float[] removeAllOccurrences(float[] a, float valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
public static double[] removeAllOccurrences(double[] a, double valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. An empty array is returned if the specified array is
nullor empty.
-
removeAllOccurrences
public static <T> T[] removeAllOccurrences(T[] a, T valueToRemove) Returns a new array with elements copied from the specified array except all occurrence of the specified value.
The original array remains unchanged.- Parameters:
a- The array from which the value should be removed.valueToRemove- The value to be removed from the array.- Returns:
- a new array with all occurrences of the specified value removed. The input array itself is returned if the specified array is
nullor empty.
-
removeAllOccurrences
Removes all occurrences of the specified value from the given collection.- Type Parameters:
T- The type of elements in the collection.- Parameters:
c- The collection from which the value should be removed.valueToRemove- The value to be removed from the collection.- Returns:
trueif the collection changed as a result of this call,falseotherwise.
-
removeDuplicates
Deprecated.Usedistinct(boolean[])instead.Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
Deprecated.Usedistinct(char[])instead.Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static char[] removeDuplicates(char[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static char[] removeDuplicates(char[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
Deprecated.Usedistinct(byte[])instead.Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static byte[] removeDuplicates(byte[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static byte[] removeDuplicates(byte[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
Deprecated.Usedistinct(short[])instead.Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static short[] removeDuplicates(short[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static short[] removeDuplicates(short[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
Deprecated.Usedistinct(int[])instead.Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static int[] removeDuplicates(int[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static int[] removeDuplicates(int[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
Deprecated.Usedistinct(long[])instead.Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static long[] removeDuplicates(long[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static long[] removeDuplicates(long[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
Deprecated.Usedistinct(float[])instead.Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static float[] removeDuplicates(float[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static float[] removeDuplicates(float[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
Deprecated.Usedistinct(double[])instead.Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static double[] removeDuplicates(double[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static double[] removeDuplicates(double[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty. - See Also:
-
removeDuplicates
Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. An empty array is returned if the specified array is
nullor empty.
-
removeDuplicates
public static String[] removeDuplicates(String[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
public static <T> T[] removeDuplicates(T[] a) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.- Returns:
- a new array with all duplicates removed. The input array itself is returned if the specified array is
nullor empty. - See Also:
-
removeDuplicates
public static <T> T[] removeDuplicates(T[] a, boolean isSorted) Returns a new array with elements from the input array but without any duplicates.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
- a new array with all duplicates removed. The input array itself is returned if the specified array is
nullor empty.
-
removeDuplicates
public static <T> T[] removeDuplicates(T[] a, int fromIndex, int toIndex, boolean isSorted) throws IndexOutOfBoundsException Returns a new array with distinct elements within the specified range.
The original array remains unchanged.- Parameters:
a- The array from which duplicates should be removed.fromIndex- The initial index of the range to be considered for duplicate removal.toIndex- The final index of the range to be considered for duplicate removal.isSorted- A boolean flag indicating whether the input array within the specified range is sorted. Iftrue, the algorithm will be faster.- Returns:
- A new array with distinct elements within the specified range.
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds.
-
removeDuplicates
Removes duplicate elements from the given collection.- Parameters:
c- The collection from which duplicates should be removed.- Returns:
trueif the collection changed as a result of this call,falseotherwise.- See Also:
-
removeDuplicates
Removes duplicate elements from the given collection.- Parameters:
c- The collection from which duplicates should be removed.isSorted- A boolean flag indicating whether the input array is sorted. Iftrue, the algorithm will be faster- Returns:
trueif the collection changed as a result of this call,falseotherwise.- See Also:
-
deleteRange
public static boolean[] deleteRange(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
deleteRange
public static char[] deleteRange(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
deleteRange
public static byte[] deleteRange(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
deleteRange
public static short[] deleteRange(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
deleteRange
public static int[] deleteRange(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
deleteRange
public static long[] deleteRange(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
deleteRange
public static float[] deleteRange(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
deleteRange
public static double[] deleteRange(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
deleteRange
public static String[] deleteRange(String[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException, IllegalArgumentException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed. An empty array is returned if the specified array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the array boundsIllegalArgumentException
-
deleteRange
public static <T> T[] deleteRange(@NotNull T[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with the specified range of elements removed
The original array remains unchanged.- Parameters:
a- the input array from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new array with the specified range of elements removed
- Throws:
IndexOutOfBoundsException- if the range is out of the array boundsIllegalArgumentException- See Also:
-
deleteRange
public static <T> boolean deleteRange(List<T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Deletes a range of elements from the given list.- Type Parameters:
T- the type of elements in the list- Parameters:
c- the input list from which a range of elements are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
trueif the list is updated;falseotherwise- Throws:
IndexOutOfBoundsException- if the range is out of the list bounds
-
deleteRange
public static String deleteRange(String str, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new String with the specified range of chars removed
The original String remains unchanged.- Parameters:
str- the input string from which a range of characters are to be deletedfromIndex- the initial index of the range to be deleted, inclusivetoIndex- the final index of the range to be deleted, exclusive- Returns:
- a new string with the specified range of characters deleted. An empty String is returned if the specified String is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of the string bounds- See Also:
-
replaceRange
public static boolean[] replaceRange(boolean[] a, int fromIndex, int toIndex, boolean[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static char[] replaceRange(char[] a, int fromIndex, int toIndex, char[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static byte[] replaceRange(byte[] a, int fromIndex, int toIndex, byte[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static short[] replaceRange(short[] a, int fromIndex, int toIndex, short[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static int[] replaceRange(int[] a, int fromIndex, int toIndex, int[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static long[] replaceRange(long[] a, int fromIndex, int toIndex, long[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static float[] replaceRange(float[] a, int fromIndex, int toIndex, float[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static double[] replaceRange(double[] a, int fromIndex, int toIndex, double[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static String[] replaceRange(String[] a, int fromIndex, int toIndex, String[] replacement) throws IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds
-
replaceRange
public static <T> T[] replaceRange(@NotNull T[] a, int fromIndex, int toIndex, T[] replacement) throws IllegalArgumentException, IndexOutOfBoundsException Returns a new array with the specified range replaced with the replacement array.
The original array remains unchanged.- Parameters:
a- the original arrayfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the array to replace the specified range in the original array- Returns:
- a new array with the specified range replaced by the replacement array
- Throws:
IndexOutOfBoundsException- if the range is out of the array boundsIllegalArgumentException
-
replaceRange
public static <T> boolean replaceRange(@NotNull List<T> c, int fromIndex, int toIndex, Collection<? extends T> replacement) throws IllegalArgumentException Replaces a range of elements in the given list with the elements from the replacement collection.- Type Parameters:
T- the type of elements in the list and replacement collection- Parameters:
c- the original list to be modifiedfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the collection to replace the specified range in the original list- Returns:
- a boolean indicating whether the list was modified
- Throws:
IndexOutOfBoundsException- if the range is out of the list boundsIllegalArgumentException
-
replaceRange
public static String replaceRange(String str, int fromIndex, int toIndex, String replacement) throws IndexOutOfBoundsException Returns a new String with the specified range replaced with the replacement String.
The original String remains unchanged.- Parameters:
str- the original stringfromIndex- the initial index of the range to be replaced, inclusivetoIndex- the final index of the range to be replaced, exclusivereplacement- the string to replace the specified range in the original string- Returns:
- a new string with the specified range replaced by the replacement string
- Throws:
IndexOutOfBoundsException- if the range is out of the string bounds- See Also:
-
moveRange
public static void moveRange(boolean[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(char[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(byte[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(short[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(int[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(long[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(float[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static void moveRange(double[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static <T> void moveRange(T[] a, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given array to a new position within the array.
No elements are deleted in the process, the original array maintains its size.- Parameters:
a- the original array to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, array.length - (toIndex - fromIndex)]- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds or newPositionStartIndex is invalid
-
moveRange
public static <T> boolean moveRange(List<T> c, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Moves a range of elements in the given list to a new position within the list.
No elements are deleted in the process, the original list maintains its size.- Type Parameters:
T- the type of elements in the list- Parameters:
c- the original list to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, list.size() - (toIndex - fromIndex)]- Returns:
trueif the list was modified as a result of this operation- Throws:
IndexOutOfBoundsException- if the range is out of the list bounds or newPositionStartIndex is invalid
-
moveRange
public static String moveRange(String str, int fromIndex, int toIndex, int newPositionStartIndex) throws IndexOutOfBoundsException Returns a new string with the specified range moved to the new position.
The original String remains unchanged.- Parameters:
str- the original string to be modifiedfromIndex- the initial index of the range to be moved, inclusivetoIndex- the final index of the range to be moved, exclusivenewPositionStartIndex- must in the range: [0, String.length - (toIndex - fromIndex)]- Returns:
- a new string with the specified range moved to the new position
- Throws:
IndexOutOfBoundsException- if the range is out of the string bounds or newPositionStartIndex is invalid- See Also:
-
skipRange
public static <T> T[] skipRange(T[] a, int startInclusive, int endExclusive) throws IndexOutOfBoundsException Returns a new array with the specified range skipped.
The original array remains unchanged.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the original array to be modifiedstartInclusive- the initial index of the range to be skipped, inclusiveendExclusive- the final index of the range to be skipped, exclusive- Returns:
- a new array with the specified range skipped
- Throws:
IndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
skipRange
public static <T> List<T> skipRange(Collection<? extends T> c, int startInclusive, int endExclusive) throws IndexOutOfBoundsException Returns a new list with the specified range skipped.
The original collection remains unchanged.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the original collection to be modifiedstartInclusive- the initial index of the range to be skipped, inclusiveendExclusive- the final index of the range to be skipped, exclusive- Returns:
- a new list with the specified range skipped
- Throws:
IndexOutOfBoundsException- if the range is out of the collection bounds
-
skipRange
public static <T,C extends Collection<T>> C skipRange(Collection<? extends T> c, int startInclusive, int endExclusive, IntFunction<C> supplier) throws IndexOutOfBoundsException Returns a new collection with the specified range skipped.
The original collection remains unchanged.- Type Parameters:
T- the type of elements in the input collectionC- the type of the collection to be returned- Parameters:
c- the original collection to be modifiedstartInclusive- the initial index of the range to be skipped, inclusiveendExclusive- the final index of the range to be skipped, exclusivesupplier- a function that creates a new instance of the desired collection type- Returns:
- a new collection with the specified range skipped
- Throws:
IndexOutOfBoundsException- if the range is out of the collection bounds
-
hasDuplicates
public static boolean hasDuplicates(boolean[] a) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(char[] a) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(char[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicatesisSorted- a boolean that indicates if the array is sorted. Iftrue, the algorithm will be faster.- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(byte[] a) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(byte[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicatesisSorted- a boolean that indicates if the array is sorted. Iftrue, the algorithm will be faster.- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(short[] a) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(short[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicatesisSorted- a boolean that indicates if the array is sorted. Iftrue, the algorithm will be faster.- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(int[] a) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(int[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicatesisSorted- a boolean that indicates if the array is sorted. Iftrue, the algorithm will be faster.- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(long[] a) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(long[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicatesisSorted- a boolean that indicates if the array is sorted. Iftrue, the algorithm will be faster.- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(float[] a) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(float[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicatesisSorted- a boolean that indicates if the array is sorted. Iftrue, the algorithm will be faster.- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(double[] a) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static boolean hasDuplicates(double[] a, boolean isSorted) Checks if the given array has duplicate elements.- Parameters:
a- the array to be checked for duplicatesisSorted- a boolean that indicates if the array is sorted. Iftrue, the algorithm will be faster.- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static <T> boolean hasDuplicates(T[] a) Checks if the given array has duplicate elements.- Type Parameters:
T-- Parameters:
a- the array to be checked for duplicates- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
public static <T> boolean hasDuplicates(T[] a, boolean isSorted) Checks if the given array has duplicate elements.- Type Parameters:
T-- Parameters:
a- the array to be checked for duplicatesisSorted- a boolean that indicates if the array is sorted. Iftrue, the algorithm will be faster.- Returns:
trueif the array has duplicates,falseotherwise
-
hasDuplicates
Checks if the given collection has duplicate elements.- Parameters:
c- the collection to be checked for duplicates- Returns:
trueif the collection has duplicates,falseotherwise
-
hasDuplicates
Checks if the given collection has duplicate elements.- Parameters:
c- the collection to be checked for duplicatesisSorted- a boolean that indicates if the collection is sorted. Iftrue, the algorithm will be faster- Returns:
trueif the collection has duplicates,falseotherwise
-
retainAll
Retains only the elements in the specified collection that are present in the specified collection of elements to keep. In other words, removes from the first collection all of its elements that are not contained in the second collection.- Type Parameters:
T- the type of elements in the input collections- Parameters:
c- the collection to be modified.objsToKeep- the collection containing elements to be retained in the first collection.- Returns:
trueif the first collection changed as a result of the call- See Also:
-
sum
Sums all elements in the given array of characters.- Parameters:
a- The array of characters to be summed.- Returns:
- The sum of all characters in the array. If the array is
nullor empty,0is returned.
-
sum
Sums all elements within the specified range in the input array of characters- Parameters:
a- The array of characters to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
sum
Sums all elements in the given array of bytes.- Parameters:
a- The array of bytes to be summed.- Returns:
- The sum of all bytes in the array. If the array is
nullor empty,0is returned.
-
sum
Sums all elements within the specified range in the input array of bytes- Parameters:
a- The array of bytes to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
sum
Sums all elements in the given array of shorts.- Parameters:
a- The array of shorts to be summed.- Returns:
- The sum of all shorts in the array. If the array is
nullor empty,0is returned.
-
sum
Sums all elements within the specified range in the input array of shorts- Parameters:
a- The array of shorts to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
sum
Sums all elements in the given array of ints.- Parameters:
a- The array of ints to be summed.- Returns:
- The sum of all ints in the array. If the array is
nullor empty,0is returned
-
sum
public static int sum(int[] a, int fromIndex, int toIndex) Sums all elements within the specified range in the input array of ints- Parameters:
a- The array of ints to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
sumToLong
Sums all elements in the given array of ints to a long value.- Parameters:
a- The array of longs to be summed.- Returns:
- The sum of all ints in the array. If the array is
nullor empty,0is returned.
-
sumToLong
Sums all elements within the specified range in the input array of ints to a long value.- Parameters:
a- The array of ints to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
sum
Sums all elements in the given array of longs.- Parameters:
a- The array of longs to be summed.- Returns:
- The sum of all longs in the array. If the array is
nullor empty,0is returned.
-
sum
Sums all elements within the specified range in the input array of longs- Parameters:
a- The array of longs to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
sum
Sums all elements in the given array of floats.- Parameters:
a- The array of floats to be summed.- Returns:
- The sum of all floats in the array. If the array is
nullor empty,0is returned.
-
sum
Sums all elements within the specified range in the input array of floats- Parameters:
a- The array of floats to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
sumToDouble
Sums all elements in the given array of floats to a double value.- Parameters:
a- The array of floats to be summed.- Returns:
- The sum of all floats in the array. If the array is
nullor empty,0is returned.
-
sumToDouble
public static double sumToDouble(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sums all elements within the specified range in the input array of floats to a double value.- Parameters:
a- The array of floats to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
sum
Sums all elements in the given array of doubles.- Parameters:
a- The array of doubles to be summed.- Returns:
- The sum of all doubles in the array. If the array is
nullor empty,0is returned.
-
sum
Sums all elements within the specified range in the input array of doubles- Parameters:
a- The array of doubles to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the input array. If the array is
nullor empty,0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.
-
average
Calculates the average of all elements in the given array of characters.- Parameters:
a- The array of characters to be averaged.- Returns:
- The average of all characters in the array. If the array is
nullor empty,0is returned.
-
average
Calculates the average of all elements within the specified range in the given array of characters.- Parameters:
a- The array of characters to be averaged.fromIndex- The starting index, inclusive.toIndex- The ending index, exclusive.- Returns:
- The average of all characters in the specified range of the array. If the specified range is empty,
0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.
-
average
Calculates the average of all elements in the given array of bytes.- Parameters:
a- The array of bytes to be averaged.- Returns:
- The average of all bytes in the array. If the array is
nullor empty,0is returned.
-
average
Calculates the average of all elements within the specified range in the given array of bytes.- Parameters:
a- The array of bytes to be averaged.fromIndex- The starting index, inclusive.toIndex- The ending index, exclusive.- Returns:
- The average of all bytes in the specified range of the array. If the specified range is empty,
0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.
-
average
Calculates the average of all elements in the given array of shorts.- Parameters:
a- The array of shorts to be averaged.- Returns:
- The average of all shorts in the array. If the array is
nullor empty,0is returned.
-
average
public static double average(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Calculates the average of all elements within the specified range in the given array of shorts.- Parameters:
a- The array of shorts to be averaged.fromIndex- The starting index, inclusive.toIndex- The ending index, exclusive.- Returns:
- The average of all shorts in the specified range of the array. If the specified range is empty,
0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.
-
average
Calculates the average of all elements in the given array of ints.- Parameters:
a- The array of ints to be averaged.- Returns:
- The average of all ints in the array. If the array is
nullor empty,0is returned.
-
average
Calculates the average of all elements within the specified range in the given array of ints.- Parameters:
a- The array of ints to be averaged.fromIndex- The starting index, inclusive.toIndex- The ending index, exclusive.- Returns:
- The average of all ints in the specified range of the array. If the specified range is empty,
0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.
-
average
Calculates the average of all elements in the given array of longs.- Parameters:
a- The array of longs to be averaged.- Returns:
- The average of all longs in the array. If the array is
nullor empty,0is returned.
-
average
Calculates the average of all elements within the specified range in the given array of longs.- Parameters:
a- The array of longs to be averaged.fromIndex- The starting index, inclusive.toIndex- The ending index, exclusive.- Returns:
- The average of all longs in the specified range of the array. If the specified range is empty,
0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.
-
average
Calculates the average of all elements in the given array of floats.- Parameters:
a- The array of floats to be averaged.- Returns:
- The average of all floats in the array. If the array is
nullor empty,0is returned.
-
average
public static double average(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Calculates the average of all elements within the specified range in the given array of floats.- Parameters:
a- The array of floats to be averaged.fromIndex- The starting index, inclusive.toIndex- The ending index, exclusive.- Returns:
- The average of all floats in the specified range of the array. If the specified range is empty,
0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.
-
average
Calculates the average of all elements in the given array of doubles.- Parameters:
a- The array of doubles to be averaged.- Returns:
- The average of all doubles in the array. If the array is
nullor empty,0is returned
-
average
public static double average(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Calculates the average of all elements within the specified range in the given array of doubles.- Parameters:
a- The array of doubles to be averaged.fromIndex- The starting index, inclusive.toIndex- The ending index, exclusive.- Returns:
- The average of all doubles in the specified range of the array. If the specified range is empty,
0is returned. - Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.
-
sumInt
Sums all elements in the given array of numbers and returns the result as an integer.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to be summed.- Returns:
- The sum of all elements in the array as an integer.
- See Also:
-
sumInt
Sums all elements within the specified range in the input array of numbers and returns the result as an integer.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the array as an integer.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.- See Also:
-
sumInt
Sums all elements in the given array using the provided function to convert each element to an integer.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array of elements to be summed.func- The function to convert each element to an integer.- Returns:
- The sum of all elements in the array as an integer.
- Throws:
IndexOutOfBoundsException- See Also:
-
sumInt
public static <T> int sumInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> func) throws IndexOutOfBoundsException Sums all elements within the specified range in the input array using the provided function to convert each element to an integer.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array of elements to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.func- The function to convert each element to an integer.- Returns:
- The sum of all elements within the specified range of the array as an integer.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.- See Also:
-
sumInt
Sums all elements within the specified range in the input collection of numbers and returns the result as an integer.- Type Parameters:
T- The type of the elements in the collection, which must extend Number.- Parameters:
c- The collection of numbers to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the collection as an integer.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given collection.- See Also:
-
sumInt
public static <T> int sumInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> func) throws IndexOutOfBoundsException Sums all elements within the specified range in the input collection using the provided function to convert each element to an integer.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection of elements to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.func- The function to convert each element to an integer.- Returns:
- The sum of all elements within the specified range of the collection as an integer.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.- See Also:
-
sumInt
Sums all elements in the given iterable of numbers and returns the result as a integer.- Type Parameters:
T- The type of the elements in the iterable, which must extend Number.- Parameters:
c- The iterable of elements to be summed.- Returns:
- The sum of all elements in the iterable as a integer.
- See Also:
-
sumInt
Sums all elements in the given iterable using the provided function to convert each element to an integer.- Type Parameters:
T- The type of the elements in the iterable.- Parameters:
c- The iterable of elements to be summed.func- The function to convert each element to an integer.- Returns:
- The sum of all elements in the iterable as an integer.
- See Also:
-
sumIntToLong
Sums all elements in the given iterable of numbers and returns the result as a long.- Type Parameters:
T- The type of the elements in the iterable, which must extend Number.- Parameters:
c- The iterable of numbers to be summed.- Returns:
- The sum of all elements in the iterable as a long.
- See Also:
-
sumIntToLong
Sums all elements in the given iterable using the provided function to convert each element to an integer and returns the result as a long.- Type Parameters:
T- The type of the elements in the iterable.- Parameters:
c- The iterable of elements to be summed.func- The function to convert each element to an integer.- Returns:
- The sum of all elements in the iterable as a long.
- See Also:
-
sumLong
Sums all elements in the given array of numbers and returns the result as a long.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to be summed.- Returns:
- The sum of all elements in the array as a long.
- See Also:
-
sumLong
Sums all elements within the specified range in the input array of numbers and returns the result as a long.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the array as a long.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.- See Also:
-
sumLong
public static <T> long sumLong(T[] a, ToLongFunction<? super T> func) throws IndexOutOfBoundsException Sums all elements in the given array using the provided function to convert each element to a long.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array of elements to be summed.func- The function to convert each element to a long.- Returns:
- The sum of all elements in the array as a long.
- Throws:
IndexOutOfBoundsException- See Also:
-
sumLong
public static <T> long sumLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> func) throws IndexOutOfBoundsException Sums all elements within the specified range in the input array using the provided function to convert each element to a long.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array of elements to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.func- The function to convert each element to a long.- Returns:
- The sum of all elements within the specified range of the array as a long.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.- See Also:
-
sumLong
public static <T extends Number> long sumLong(Collection<? extends T> c, int fromIndex, int toIndex) Sums all elements within the specified range in the input collection of numbers and returns the result as an long.- Type Parameters:
T- The type of the elements in the collection, which must extend Number.- Parameters:
c- The collection of numbers to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the collection as an long.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given collection.- See Also:
-
sumLong
public static <T> long sumLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> func) throws IndexOutOfBoundsException Sums all elements within the specified range in the input collection using the provided function to convert each element to a long.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection of elements to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.func- The function to convert each element to a long.- Returns:
- The sum of all elements within the specified range of the collection as a long.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.- See Also:
-
sumLong
Sums all elements in the given iterable of numbers and returns the result as a long.- Type Parameters:
T- The type of the elements in the iterable, which must extend Number.- Parameters:
c- The iterable of numbers to be summed.- Returns:
- The sum of all elements in the iterable as a long.
- See Also:
-
sumLong
Sums all elements in the given iterable using the provided function to convert each element to a long.- Type Parameters:
T- The type of the elements in the iterable.- Parameters:
c- The iterable of elements to be summed.func- The function to convert each element to a long.- Returns:
- The sum of all elements in the iterable as a long.
- See Also:
-
sumDouble
Sums all elements in the given array of numbers and returns the result as a double.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to be summed.- Returns:
- The sum of all elements in the array as a double.
- See Also:
-
sumDouble
Sums all elements within the specified range in the input array of numbers and returns the result as a double.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the array as a double.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given array.- See Also:
-
sumDouble
Sums all elements in the given array using the provided function to convert each element to a double.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array of elements to be summed.func- The function to convert each element to a double.- Returns:
- The sum of all elements in the array as a double.
- See Also:
-
sumDouble
public static <T> double sumDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException Sums all elements within the specified range in the input array using the provided function to convert each element to a double.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array of elements to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.func- The function to convert each element to a double.- Returns:
- The sum of all elements within the specified range of the array as a double.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.- See Also:
-
sumDouble
public static <T extends Number> double sumDouble(Collection<? extends T> c, int fromIndex, int toIndex) Sums all elements within the specified range in the input collection of numbers and returns the result as an double.- Type Parameters:
T- The type of the elements in the collection, which must extend Number.- Parameters:
c- The collection of numbers to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.- Returns:
- The sum of all elements within the specified range in the collection as an double.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds for the given collection.- See Also:
-
sumDouble
public static <T> double sumDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException Sums all elements within the specified range in the input collection using the provided function to convert each element to a double.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection of elements to be summed.fromIndex- The starting index (inclusive) of the range to be summed.toIndex- The ending index (exclusive) of the range to be summed.func- The function to convert each element to a double.- Returns:
- The sum of all elements within the specified range of the collection as a double.
- Throws:
IndexOutOfBoundsException- If the specified range is out of bounds.- See Also:
-
sumDouble
Sums all elements in the given iterable of numbers and returns the result as a double.- Type Parameters:
T- The type of the elements in the iterable, which must extend Number.- Parameters:
c- The iterable of numbers to be summed.- Returns:
- The sum of all elements in the iterable as a double.
- See Also:
-
sumDouble
Sums all elements in the given iterable using the provided function to convert each element to a double.- Type Parameters:
T- The type of the elements in the iterable.- Parameters:
c- The iterable of elements to be summed.func- The function to convert each element to a double.- Returns:
- The sum of all elements in the iterable as a double.
- See Also:
-
sumBigInteger
Sums all elements in the given iterable of BigInteger and returns the result as a BigInteger.- Parameters:
c- The iterable of BigInteger elements to be summed.- Returns:
- The sum of all elements in the iterable as a BigInteger.
- See Also:
-
sumBigInteger
public static <T> BigInteger sumBigInteger(Iterable<? extends T> c, Function<? super T, BigInteger> func) Sums all elements in the given iterable using the provided function to convert each element to a BigInteger.- Type Parameters:
T- The type of elements in the iterable.- Parameters:
c- The iterable of elements to be summed.func- The function to convert each element to a BigInteger.- Returns:
- The sum of all elements in the iterable as a BigInteger.
- See Also:
-
sumBigDecimal
Sums all elements in the given iterable of BigDecimal and returns the result as a BigDecimal.- Parameters:
c- The iterable of BigDecimal elements to be summed.- Returns:
- The sum of all elements in the iterable as a BigDecimal.
- See Also:
-
sumBigDecimal
public static <T> BigDecimal sumBigDecimal(Iterable<? extends T> c, Function<? super T, BigDecimal> func) Sums all elements in the given iterable using the provided function to convert each element to a BigDecimal.- Type Parameters:
T- The type of elements in the iterable.- Parameters:
c- The iterable of elements to be summed.func- The function to convert each element to a BigDecimal.- Returns:
- The sum of all elements in the iterable as a BigDecimal.
- See Also:
-
averageInt
Calculates the average of the elements in the given array of numbers.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to calculate the average.- Returns:
- The average of the elements in the array as a double.
- See Also:
-
averageInt
Calculates the average of the elements in the given array of numbers within the specified range.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to calculate the average.fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageInt
Calculates the average of the elements in the given array using the provided function to convert each element to an integer.- Type Parameters:
T- The type of the elements in the array- Parameters:
a- The array of numbers to calculate the average.func- The function to convert each element to an integer.- Returns:
- The average of the elements in the array as a double.
- See Also:
-
averageInt
public static <T> double averageInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to an integer.- Type Parameters:
T- The type of the elements in the array- Parameters:
a- The array to calculate the average.fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.func- The function to convert each element to an integer.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageInt
public static <T extends Number> double averageInt(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of the elements within the specified range in the input collection of numbers.- Type Parameters:
T- The type of the elements in the collection, which must extend Number.- Parameters:
c- The collection of numbers to calculate the average.fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageInt
public static <T> double averageInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to an integer.- Type Parameters:
T- The type of the elements in the collection- Parameters:
fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.func- The function to convert each element to an integer.a- The array to calculate the average.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageInt
Calculates the average of the elements in the given iterable of numbers.- Type Parameters:
T- The type of the elements in the iterable, which must extend Number.- Parameters:
c- The iterable of numbers to calculate the average.- Returns:
- The average of the elements in the iterable as a double.
- See Also:
-
averageInt
Calculates the average of the elements in the given iterable using the provided function to convert each element to an integer.- Type Parameters:
T- The type of the elements in the iterable.- Parameters:
c- The iterable of elements to calculate the average.func- The function to convert each element to an integer.- Returns:
- The average of the elements in the iterable as a double.
- See Also:
-
averageLong
Calculates the average of the elements in the given array of numbers.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to calculate the average.- Returns:
- The average of the elements in the array as a double.
- See Also:
-
averageLong
Calculates the average of the elements within the specified range in the input array of numbers.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to calculate the average.fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageLong
Calculates the average of the elements in the given array using the provided function to convert each element to a long.- Type Parameters:
T- The type of the elements in the array- Parameters:
a- The array of numbers to calculate the average.func- The function to convert each element to a long.- Returns:
- The average of the elements in the array as a double.
- See Also:
-
averageLong
public static <T> double averageLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to a long.- Type Parameters:
T- The type of the elements in the array- Parameters:
a- The array of numbers to calculate the average.fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.func- The function to convert each element to a long.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageLong
public static <T extends Number> double averageLong(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of the elements in the given collection of numbers.- Type Parameters:
T- The type of the elements in the collection, which must extend Number.- Parameters:
c- The collection of numbers to calculate the average.- Returns:
- The average of the elements in the collection as a double.
- See Also:
-
averageLong
public static <T> double averageLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to a long.- Type Parameters:
T- The type of the elements in the collection- Parameters:
fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.func- The function to convert each element to a long.a- The array to calculate the average.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageLong
Calculates the average of the elements in the given iterable of numbers.- Type Parameters:
T- The type of the elements in the iterable, which must extend Number.- Parameters:
c- The iterable of numbers to calculate the average.- Returns:
- The average of the elements in the iterable as a double.
- See Also:
-
averageLong
Calculates the average of the elements in the given iterable using the provided function to convert each element to a long.- Type Parameters:
T- The type of the elements in the iterable.- Parameters:
c- The iterable of elements to calculate the average.func- The function to convert each element to a long.- Returns:
- The average of the elements in the iterable as a double.
- See Also:
-
averageDouble
Calculates the average of the elements in the given array of numbers.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to calculate the average.- Returns:
- The average of the elements in the array as a double.
- See Also:
-
averageDouble
Calculates the average of the elements within the specified range in the input array of numbers.- Type Parameters:
T- The type of the elements in the array, which must extend Number.- Parameters:
a- The array of numbers to calculate the average.fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageDouble
Calculates the average of the elements in the given array using the provided function to convert each element to a double.- Type Parameters:
T- The type of the elements in the array- Parameters:
a- The array to calculate the average.func- The function to convert each element to a double.- Returns:
- The average of the elements in the array as a double.
- See Also:
-
averageDouble
public static <T> double averageDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of the elements within the specified range in the input array using the provided function to convert each element to a double.- Type Parameters:
T- The type of the elements in the array- Parameters:
a- The array to calculate the average.fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.func- The function to convert each element to a double.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageDouble
public static <T extends Number> double averageDouble(Collection<? extends T> c, int fromIndex, int toIndex) Calculates the average of the elements in the given collection of numbers.- Type Parameters:
T- The type of the elements in the collection, which must extend Number.- Parameters:
c- The collection of numbers to calculate the average.- Returns:
- The average of the elements in the collection as a double.
- See Also:
-
averageDouble
public static <T> double averageDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> func) throws IndexOutOfBoundsException Calculates the average of the elements within the specified range in the input collection using the provided function to convert each element to a double.- Type Parameters:
T- The type of the elements in the collection- Parameters:
c- The collection to calculate the average.fromIndex- The starting index (inclusive) of the range.toIndex- The ending index (exclusive) of the range.func- The function to convert each element to a double.- Returns:
- The average of the elements within the specified range as a double.
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds.- See Also:
-
averageDouble
Calculates the average of the elements in the given iterable of numbers.- Type Parameters:
T- The type of the elements in the iterable, which must extend Number.- Parameters:
c- The iterable of numbers to calculate the average.- Returns:
- The average of the elements in the iterable as a double.
- See Also:
-
averageDouble
Calculates the average of the elements in the given iterable using the provided function to convert each element to a double.- Type Parameters:
T- The type of the elements in the iterable.- Parameters:
c- The iterable of elements to calculate the average.func- The function to convert each element to a double.- Returns:
- The average of the elements in the iterable as a double.
- See Also:
-
averageBigInteger
Calculates the average of the elements in the given iterable of BigInteger.- Parameters:
c- The iterable of BigInteger elements to calculate the average.- Returns:
- The average of the elements in the iterable as a BigDecimal.
- See Also:
-
averageBigInteger
public static <T> BigDecimal averageBigInteger(Iterable<? extends T> c, Function<? super T, BigInteger> func) Calculates the average of the elements in the given iterable using the provided function to convert each element to a BigInteger.- Type Parameters:
T- The type of elements in the iterable.- Parameters:
c- The iterable of elements to calculate the average.func- The function to convert each element to a BigInteger.- Returns:
- The average of the elements in the iterable as a BigDecimal.
- See Also:
-
averageBigDecimal
Calculates the average of the elements in the given iterable of BigDecimal.- Parameters:
c- The iterable of BigDecimal elements to calculate the average.- Returns:
- The average of the elements in the iterable as a BigDecimal.
- See Also:
-
averageBigDecimal
public static <T> BigDecimal averageBigDecimal(Iterable<? extends T> c, Function<? super T, BigDecimal> func) Calculates the average of the elements in the given iterable using the provided function to convert each element to a BigDecimal.- Type Parameters:
T- The type of elements in the iterable.- Parameters:
c- The iterable of elements to calculate the average.func- The function to convert each element to a BigDecimal.- Returns:
- The average of the elements in the iterable as a BigDecimal.
- See Also:
-
min
public static char min(char a, char b) Returns the smaller of two input char values.- Parameters:
a- the first char value.b- the second char value.- Returns:
- the smaller of two input char values.
-
min
public static byte min(byte a, byte b) Returns the smaller of two input byte values.- Parameters:
a- the first byte value.b- the second byte value.- Returns:
- the smaller of two input byte values.
-
min
public static short min(short a, short b) Returns the smaller of two input short values.- Parameters:
a- the first short value.b- the second short value.- Returns:
- the smaller of two input short values.
-
min
public static int min(int a, int b) Returns the smaller of two input int values.- Parameters:
a- the first int value.b- the second int value.- Returns:
- the smaller of two input int values
-
min
public static long min(long a, long b) Returns the smaller of two input long values.- Parameters:
a- the first long value.b- the second long value.- Returns:
- the smaller of two input long values.
-
min
public static float min(float a, float b) Returns the smaller of two input float values.- Parameters:
a- the first float value.b- the second float value.- Returns:
- the smaller of two input float values.
-
min
public static double min(double a, double b) Returns the smaller of two input double values.- Parameters:
a- the first double value.b- the second double value.- Returns:
- the smaller of two input double values.
-
min
Returns the smaller of two input comparable values.- Parameters:
a- the first comparable value.b- the second comparable value.- Returns:
- the smaller of two input comparable values.
-
min
Returns the smaller of two input values based on the specified comparator.- Type Parameters:
T- the type of the values- Parameters:
a- the first value to compareb- the second value to comparecmp- the Comparator to compare the values- Returns:
- the smaller of two input values based on the specified comparator
-
min
public static char min(char a, char b, char c) Returns the smallest of the three input char values.- Parameters:
a- the first char value.b- the second char value.c- the third char value.- Returns:
- the smallest of the three input char values.
-
min
public static byte min(byte a, byte b, byte c) Returns the smallest of the three input byte values.- Parameters:
a- the first byte value.b- the second byte value.c- the third byte value.- Returns:
- the smallest of the three input byte values.
-
min
public static short min(short a, short b, short c) Returns the smallest of the three input short values.- Parameters:
a- the first short value.b- the second short value.c- the third short value.- Returns:
- the smallest of the three input short values.
-
min
public static int min(int a, int b, int c) Returns the smallest of the three input int values.- Parameters:
a- the first int value.b- the second int value.c- the third int value.- Returns:
- the smallest of the three input int values.
-
min
public static long min(long a, long b, long c) Returns the smallest of the three input long values.- Parameters:
a- the first long value.b- the second long value.c- the third long value.- Returns:
- the smallest of the three input long values.
-
min
public static float min(float a, float b, float c) Returns the smallest of the three input float values.- Parameters:
a- the first float value.b- the second float value.c- the third float value.- Returns:
- the smallest of the three input float values.
-
min
public static double min(double a, double b, double c) Returns the smallest of the three input double values.- Parameters:
a- the first double value.b- the second double value.c- the third double value.- Returns:
- the smallest of the three input double values.
-
min
Returns the smallest of the three input comparable values.- Parameters:
a- the first comparable value.b- the second comparable value.c- the third comparable value.- Returns:
- the smallest of the three input comparable values.
-
min
Returns the smallest of the three input values based on the specified comparator.- Type Parameters:
T- the type of the values- Parameters:
a- the first value to compareb- the second value to comparec- the third value to comparecmp- the Comparator to compare the values- Returns:
- the smallest of the three input values based on the specified comparator
-
min
Returns the smallest char value in the specified array.- Parameters:
a- the array of char values to fetch the smallest value.- Returns:
- the smallest char value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.
-
min
Returns the smallest char value within the specified range in the input array.- Parameters:
a- the array of char values to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest char value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
min
Returns the smallest byte value in the specified array.- Parameters:
a- the array of byte values to fetch the smallest value.- Returns:
- the smallest byte value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.
-
min
Returns the smallest byte value within the specified range in the input array.- Parameters:
a- the array of byte values to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest byte value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
min
Returns the smallest short value in the specified array.- Parameters:
a- the array of short values to fetch the smallest value.- Returns:
- the smallest short value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.
-
min
Returns the smallest short value within the specified range in the input array.- Parameters:
a- the array of short values to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest short value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
min
Returns the smallest int value in the specified array.- Parameters:
a- the array of int values to fetch the smallest value.- Returns:
- the smallest int value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.
-
min
Returns the smallest int value within the specified range in the input array.- Parameters:
a- the array of int values to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest int value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
min
Returns the smallest long value in the specified array.- Parameters:
a- the array of long values to fetch the smallest value.- Returns:
- the smallest long value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.
-
min
Returns the smallest long value within the specified range in the input array.- Parameters:
a- the array of long values to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest long value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
min
Returns the smallest float value in the specified array.- Parameters:
a- the array of float values to fetch the smallest value.- Returns:
- the smallest float value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.- See Also:
-
min
Returns the smallest float value within the specified range in the input array.- Parameters:
a- the array of float values to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest float value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.- See Also:
-
min
Returns the smallest double value in the specified array.- Parameters:
a- the array of double values to fetch the smallest value.- Returns:
- the smallest double value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.- See Also:
-
min
Returns the smallest double value within the specified range in the input array.- Parameters:
a- the array of double values to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest double value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.- See Also:
-
min
Returns the smallest value in the specified array based on their natural ordering. Null values are considered to be maximum here.- Parameters:
a- the array to fetch the smallest value.- Returns:
- the smallest value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.- See Also:
-
min
public static <T extends Comparable<? super T>> T min(T[] a, int fromIndex, int toIndex) throws IllegalArgumentException Returns the smallest value within the specified range in the input array based on their natural ordering. Null values are considered to be maximum here.- Parameters:
a- the array to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.- See Also:
-
min
Returns the smallest value in the specified array according to the provided comparator.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to fetch the smallest value.cmp- the comparator to be used to compare the elements- Returns:
- the smallest value in the array.
- Throws:
IllegalArgumentException- if the array isnullor empty.- See Also:
-
min
public static <T> T min(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns the smallest value within the specified range in the input array according to the provided comparator.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.cmp- the comparator to be used to compare the elements- Returns:
- the smallest value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.IndexOutOfBoundsException- See Also:
-
min
public static <T extends Comparable<? super T>> T min(Collection<? extends T> c, int fromIndex, int toIndex) throws IllegalArgumentException Returns the smallest value within the specified range in the input collection based on their natural ordering. Null values are considered to be maximum here.- Parameters:
c- the collection to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.- Returns:
- the smallest value within the specified range of the collection.
- Throws:
IllegalArgumentException- if the specified collection or range is empty.- See Also:
-
min
public static <T> T min(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException Returns the smallest value within the specified range in the input collection according to the provided comparator.- Parameters:
c- the collection to fetch the smallest value.fromIndex- the starting index (inclusive) of the range.toIndex- the ending index (exclusive) of the range.cmp- the comparator to be used to compare the elements- Returns:
- the smallest value within the specified range of the collection.
- Throws:
IllegalArgumentException- if the specified collection or range is empty.- See Also:
-
min
public static <T extends Comparable<? super T>> T min(Iterable<? extends T> c) throws IllegalArgumentException Returns the smallest value in the specified iterable based on their natural ordering. Null values are considered to be maximum here.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to fetch the smallest value.- Returns:
- the smallest value in the iterable.
- Throws:
IllegalArgumentException- if the specified iterable isnullor empty.- See Also:
-
min
public static <T> T min(Iterable<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException Returns the smallest value in the specified iterable according to the provided comparator.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to fetch the smallest value.cmp- the comparator to be used to compare the elements- Returns:
- the smallest value in the iterable.
- Throws:
IllegalArgumentException- if the specified iterable isnullor empty.- See Also:
-
min
public static <T extends Comparable<? super T>> T min(Iterator<? extends T> iter) throws IllegalArgumentException Returns the smallest value in the specified iterator based on their natural ordering. Null values are considered to be maximum here.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to fetch the smallest value.- Returns:
- the smallest value in the iterator.
- Throws:
IllegalArgumentException- if the iterator isnullor empty.- See Also:
-
min
public static <T> T min(Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException Returns the smallest value in the specified iterator according to the provided comparator.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to fetch the smallest value.cmp- the comparator to be used to compare the elements- Returns:
- the smallest value in the iterator.
- Throws:
IllegalArgumentException- if the specified iterator isnullor empty.- See Also:
-
minAll
Returns a list containing the smallest elements in the specified array based on their natural ordering. Null values are considered to be maximum here.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to fetch the smallest elements.- Returns:
- a list containing the smallest elements in the array. If the array is
nullor empty, an empty list is returned.
-
minAll
Returns a list containing the smallest elements in the specified array according to the provided comparator.- Type Parameters:
T- the type of elements in the array.- Parameters:
a- the array to fetch the smallest elements.cmp- the comparator to be used to compare the elements- Returns:
- a list containing the smallest elements in the array. If the array is
nullor empty, an empty list is returned.
-
minAll
Returns a list containing the smallest elements in the specified iterable based on their natural ordering. Null values are considered to be maximum here.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to fetch the smallest elements.- Returns:
- a list containing the smallest elements in the iterable. If the iterable is
nullor empty, an empty list is returned.
-
minAll
Returns a list containing the smallest elements in the specified iterable according to the provided comparator.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to fetch the smallest elements.cmp- the comparator to be used to compare the elements- Returns:
- a list containing the smallest elements in the iterable. If the iterable is
nullor empty, an empty list is returned.
-
minAll
Returns a list containing the smallest elements in the specified iterator based on their natural ordering. Null values are considered to be maximum here.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to fetch the smallest elements.- Returns:
- a list containing the smallest elements in the iterator. If the iterator is
nullor empty, an empty list is returned.
-
minAll
Returns a list containing the smallest elements in the specified iterator according to the provided comparator.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to fetch the smallest elements.cmp- the comparator to be used to compare the elements- Returns:
- a list containing the smallest elements in the iterator. If the iterator is
nullor empty, an empty list is returned.
-
minOrDefaultIfEmpty
@Beta public static <T,R extends Comparable<? super R>> R minOrDefaultIfEmpty(T[] a, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified array or a default value if the array isnullor empty. Null values are considered to be maximum here.- Type Parameters:
T- the type of elements in the input array.R- the type of the extracted value, which must be comparable.- Parameters:
a- the array to extract the minimum value from.valueExtractor- the function to extract values from the array elements for comparison.defaultValue- the default value to return if the array isnullor empty.- Returns:
- the minimum extracted value or the default value if the array is
nullor empty.
-
minOrDefaultIfEmpty
public static <T,R extends Comparable<? super R>> R minOrDefaultIfEmpty(Iterable<? extends T> c, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified iterable or a default value if the iterable isnullor empty. Null values are considered to be maximum here.- Type Parameters:
T- the type of elements in the input iterable.R- the type of the extracted value, which must be comparable.- Parameters:
c- the iterable to extract the minimum value from.valueExtractor- the function to extract values from the iterable elements for comparison.defaultValue- the default value to return if the iterable isnullor empty.- Returns:
- the minimum extracted value or the default value if the iterable is
nullor empty.
-
minOrDefaultIfEmpty
public static <T,R extends Comparable<? super R>> R minOrDefaultIfEmpty(Iterator<? extends T> iter, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the minimum value extracted from the specified iterator or a default value if the iterator isnullor empty. Null values are considered to be maximum here.- Type Parameters:
T- the type of elements in the input iterator.R- the type of the extracted value, which must be comparable.- Parameters:
iter- the iterator to extract the minimum value from.valueExtractor- the function to extract values from the iterator elements for comparison.defaultValue- the default value to return if the iterator isnullor empty.- Returns:
- the minimum extracted value or the default value if the iterator is
nullor empty.
-
minIntOrDefaultIfEmpty
@Beta public static <T> int minIntOrDefaultIfEmpty(T[] a, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimum integer value extracted from the array or a default value if the array isnullor empty.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to extract the minimum integer from.valueExtractor- the function to extract integer values from the array elements.defaultValue- the default value to return if the array isnullor empty.- Returns:
- the minimum extracted integer value or the default value if the array is
nullor empty.
-
minIntOrDefaultIfEmpty
@Beta public static <T> int minIntOrDefaultIfEmpty(Iterable<? extends T> c, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimum integer value extracted from the specified iterable or a default value if the iterable isnullor empty.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to extract the minimum integer from.valueExtractor- the function to extract integer values from the iterable elements.defaultValue- the default value to return if the iterable isnullor empty.- Returns:
- the minimum extracted integer value or the default value if the iterable is
nullor empty.
-
minIntOrDefaultIfEmpty
@Beta public static <T> int minIntOrDefaultIfEmpty(Iterator<? extends T> iter, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the minimum integer value extracted from the specified iterator or a default value if the iterator isnullor empty.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to extract the minimum integer from.valueExtractor- the function to extract integer values from the iterator elements.defaultValue- the default value to return if the iterator isnullor empty.- Returns:
- the minimum extracted integer value or the default value if the iterator is
nullor empty.
-
minLongOrDefaultIfEmpty
@Beta public static <T> long minLongOrDefaultIfEmpty(T[] a, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimum long value extracted from the specified array or a default value if the array isnullor empty.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to extract the minimum long from.valueExtractor- the function to extract long values from the array elements.defaultValue- the default value to return if the array isnullor empty.- Returns:
- the minimum extracted long value or the default value if the array is
nullor empty.
-
minLongOrDefaultIfEmpty
@Beta public static <T> long minLongOrDefaultIfEmpty(Iterable<? extends T> c, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimum long value extracted from the specified iterable or a default value if the iterable isnullor empty.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to extract the minimum long from.valueExtractor- the function to extract long values from the iterable elements.defaultValue- the default value to return if the iterable isnullor empty.- Returns:
- the minimum extracted long value or the default value if the iterable is
nullor empty.
-
minLongOrDefaultIfEmpty
@Beta public static <T> long minLongOrDefaultIfEmpty(Iterator<? extends T> iter, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the minimum long value extracted from the specified iterator or a default value if the iterator isnullor empty.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to extract the minimum long from.valueExtractor- the function to extract long values from the iterator elements.defaultValue- the default value to return if the iterator isnullor empty.- Returns:
- the minimum extracted long value or the default value if the iterator is
nullor empty.
-
minDoubleOrDefaultIfEmpty
@Beta public static <T> double minDoubleOrDefaultIfEmpty(T[] a, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimum double value extracted from the specified array or a default value if the array isnullor empty.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to extract the minimum double from.valueExtractor- the function to extract double values from the array elements.defaultValue- the default value to return if the array isnullor empty.- Returns:
- the minimum extracted double value or the default value if the array is
nullor empty.
-
minDoubleOrDefaultIfEmpty
@Beta public static <T> double minDoubleOrDefaultIfEmpty(Iterable<? extends T> c, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimum double value extracted from the specified iterable or a default value if the iterable isnullor empty.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to extract the minimum double from.valueExtractor- the function to extract double values from the iterable elements.defaultValue- the default value to return if the iterable isnullor empty.- Returns:
- the minimum extracted double value or the default value if the iterable is
nullor empty.
-
minDoubleOrDefaultIfEmpty
@Beta public static <T> double minDoubleOrDefaultIfEmpty(Iterator<? extends T> iter, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the minimum double value extracted from the specified iterator or a default value if the iterator isnullor empty.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to extract the minimum double from.valueExtractor- the function to extract double values from the iterator elements.defaultValue- the default value to return if the iterator isnullor empty.- Returns:
- the minimum extracted double value or the default value if the iterator is
nullor empty.
-
minMax
public static <T extends Comparable<? super T>> Pair<T,T> minMax(T[] a) throws IllegalArgumentException Returns a Pair object containing the minimum and maximum values in the specified array based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input array, which must be comparable.- Parameters:
a- the array to find the minimum and maximum values from.- Returns:
- a Pair object where the first element is the minimum value and the second element is the maximum value in the specified array.
- Throws:
IllegalArgumentException- if the array isnullor empty.- See Also:
-
minMax
public static <T> Pair<T,T> minMax(T[] a, Comparator<? super T> cmp) throws IllegalArgumentException Returns a Pair object containing the minimum and maximum values in the specified array according to the provided comparator.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to find the minimum and maximum values from.cmp- the comparator to be used to compare the elements- Returns:
- a Pair object where the first element is the minimum value and the second element is the maximum value in the specified array.
- Throws:
IllegalArgumentException- if the array isnullor empty.- See Also:
-
minMax
public static <T extends Comparable<? super T>> Pair<T,T> minMax(Iterable<? extends T> c) throws IllegalArgumentException Returns a Pair object containing the minimum and maximum values in the specified iterable based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input iterable, which must be comparable.- Parameters:
c- the iterable to find the minimum and maximum values from.- Returns:
- a Pair object where the first element is the minimum value and the second element is the maximum value in the specified iterable.
- Throws:
IllegalArgumentException- if the iterable isnullor empty.- See Also:
-
minMax
public static <T> Pair<T,T> minMax(@NotNull Iterable<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException Returns a Pair object containing the minimum and maximum values in the specified iterable according to the provided comparator.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to find the minimum and maximum values from.cmp- the comparator to be used to compare the elements- Returns:
- a Pair object where the first element is the minimum value and the second element is the maximum value in the specified iterable.
- Throws:
IllegalArgumentException- if the iterable isnullor empty.- See Also:
-
minMax
public static <T extends Comparable<? super T>> Pair<T,T> minMax(Iterator<? extends T> iter) throws IllegalArgumentException Returns a Pair object containing the minimum and maximum values in the specified iterator based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input iterator, which must be comparable.- Parameters:
iter- the iterator to find the minimum and maximum values from.- Returns:
- a Pair object where the first element is the minimum value and the second element is the maximum value in the specified iterator.
- Throws:
IllegalArgumentException- if the iterator isnullor empty.- See Also:
-
minMax
public static <T> Pair<T,T> minMax(Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException Returns a Pair object containing the minimum and maximum values in the specified iterator according to the provided comparator.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to find the minimum and maximum values from.cmp- the comparator to be used to compare the elements- Returns:
- a Pair object where the first element is the minimum value and the second element is the maximum value in the specified iterator.
- Throws:
IllegalArgumentException- if the iterator isnullor empty.- See Also:
-
max
public static char max(char a, char b) Returns the bigger of two char values.- Parameters:
a- the first char value.b- the second char value.- Returns:
- the bigger of the two char values.
-
max
public static byte max(byte a, byte b) Returns the bigger of two byte values.- Parameters:
a- the first byte value.b- the second byte value.- Returns:
- the bigger of the two byte values.
-
max
public static short max(short a, short b) Returns the bigger of two short values.- Parameters:
a- the first short value.b- the second short value.- Returns:
- the bigger of the two short values.
-
max
public static int max(int a, int b) Returns the bigger of two int values.- Parameters:
a- the first int value.b- the second int value.- Returns:
- the bigger of the two int values.
-
max
public static long max(long a, long b) Returns the bigger of two long values.- Parameters:
a- the first long value.b- the second long value.- Returns:
- the bigger of the two long values.
-
max
public static float max(float a, float b) Returns the bigger of two float values.- Parameters:
a- the first float value.b- the second float value.- Returns:
- the bigger of the two float values.
-
max
public static double max(double a, double b) Returns the bigger of two double values.- Parameters:
a- the first double value.b- the second double value.- Returns:
- the bigger of the two double values.
-
max
Returns the bigger value of the two provided values based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of the objects being compared, which must be comparable.- Parameters:
a- the first object to compare.b- the second object to compare.- Returns:
- the bigger value of the two provided values.
-
max
Returns the bigger value of the two provided values according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
a- the first object to compare.b- the second object to compare.cmp- the comparator to be used to compare the objects- Returns:
- the bigger value of the two provided values.
-
max
public static char max(char a, char b, char c) Returns the biggest value among the provided values.- Parameters:
a- the first char value.b- the second char value.c- the third char value.- Returns:
- the biggest value among the provided values.
-
max
public static byte max(byte a, byte b, byte c) Returns the biggest value among the provided values.- Parameters:
a- the first byte value.b- the second byte value.c- the third byte value.- Returns:
- the biggest value among the provided values.
-
max
public static short max(short a, short b, short c) Returns the biggest value among the provided values.- Parameters:
a- the first short value.b- the second short value.c- the third short value.- Returns:
- the biggest value among the provided values.
-
max
public static int max(int a, int b, int c) Returns the biggest value among the provided values.- Parameters:
a- the first int value.b- the second int value.c- the third int value.- Returns:
- the biggest value among the provided values.
-
max
public static long max(long a, long b, long c) Returns the biggest value among the provided values.- Parameters:
a- the first long value.b- the second long value.c- the third long value.- Returns:
- the biggest value among the provided values.
-
max
public static float max(float a, float b, float c) Returns the biggest value among the provided values.- Parameters:
a- the first float value.b- the second float value.c- the third float value.- Returns:
- the biggest value among the provided values.
-
max
public static double max(double a, double b, double c) Returns the biggest value among the provided values.- Parameters:
a- the first double value.b- the second double value.c- the third double value.- Returns:
- the biggest value among the provided values.
-
max
Returns the biggest value among the provided values based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of the objects being compared, which must be comparable.- Parameters:
a- the first object to compare.b- the second object to compare.c- the third object to compare.- Returns:
- the biggest value among the provided values.
-
max
Returns the biggest value among the provided values according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
a- the first object to compare.b- the second object to compare.c- the third object to compare.cmp- the comparator to be used to compare the objects- Returns:
- the biggest value among the provided values.
-
max
Returns the biggest char value in the specified array of char values.- Parameters:
a- the array of char values to be compared.- Returns:
- the biggest char value in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.
-
max
Returns the biggest char value within the given range in the specified array of char values.- Parameters:
a- the array of char values to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.- Returns:
- the biggest char value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
max
Returns the biggest byte value in the specified array of byte values.- Parameters:
a- the array of byte values to be compared.- Returns:
- the biggest byte value in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.
-
max
Returns the biggest byte value within the given range in the specified array of byte values.- Parameters:
a- the array of byte values to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.- Returns:
- the biggest byte value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
max
Returns the biggest short value in the specified array of short values.- Parameters:
a- the array of short values to be compared.- Returns:
- the biggest short value in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.
-
max
Returns the biggest short value within the given range in the specified array of short values.- Parameters:
a- the array of short values to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.- Returns:
- the biggest short value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
max
Returns the biggest int value in the specified array of int values.- Parameters:
a- the array of int values to be compared.- Returns:
- the biggest int value in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.
-
max
Returns the biggest int value within the given range in the specified array of int values.- Parameters:
a- the array of int values to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.- Returns:
- the biggest int value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
max
Returns the biggest long value in the specified array of long values.- Parameters:
a- the array of long values to be compared.- Returns:
- the biggest long value in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.
-
max
Returns the biggest long value within the given range in the specified array of long values.- Parameters:
a- the array of long values to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.- Returns:
- the biggest long value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.
-
max
Returns the biggest float value in the specified array of float values.- Parameters:
a- the array of float values to be compared.- Returns:
- the biggest float value in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.- See Also:
-
max
Returns the biggest float value within the given range in the specified array of float values.- Parameters:
a- the array of float values to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.- Returns:
- the biggest float value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.- See Also:
-
max
Returns the biggest double value in the specified array of double values.- Parameters:
a- the array of double values to be compared.- Returns:
- the biggest double value in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.- See Also:
-
max
Returns the biggest double value within the given range in the specified array of double values.- Parameters:
a- the array of double values to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.- Returns:
- the biggest double value within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.- See Also:
-
max
Returns the biggest element in the specified array based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of the objects being compared, which must be comparable.- Parameters:
a- the array of comparable objects to be compared.- Returns:
- the biggest element in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.- See Also:
-
max
public static <T extends Comparable<? super T>> T max(T[] a, int fromIndex, int toIndex) throws IllegalArgumentException Returns the biggest element within the given range in the specified array based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of the objects being compared, which must be comparable.- Parameters:
a- the array of comparable objects to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.- Returns:
- the biggest element within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.- See Also:
-
max
Returns the biggest element in the specified array according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
a- the array of objects to be compared.cmp- the comparator to be used to compare the objects- Returns:
- the biggest element in the array.
- Throws:
IllegalArgumentException- if the specified array isnullor empty.- See Also:
-
max
public static <T> T max(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns the biggest element within the given range in the specified array according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
a- the array of objects to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.cmp- the comparator to be used to compare the objects- Returns:
- the biggest element within the specified range of the array.
- Throws:
IllegalArgumentException- if the specified array or range is empty.IndexOutOfBoundsException- See Also:
-
max
public static <T extends Comparable<? super T>> T max(Collection<? extends T> c, int fromIndex, int toIndex) throws IllegalArgumentException Returns the biggest element within the given range in the specified collection according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
c- the collection of objects to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.cmp- the comparator to be used to compare the objects- Returns:
- the biggest element within the specified range of the collection.
- Throws:
IllegalArgumentException- if the specified collection or range is empty.- See Also:
-
max
public static <T> T max(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException Returns the biggest element within the given range in the specified collection according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
c- the collection of objects to be compared.fromIndex- the index of the first element (inclusive) to be considered in the range.toIndex- the index of the last element (exclusive) to be considered in the range.cmp- the comparator to be used to compare the objects- Returns:
- the biggest element within the specified range of the collection.
- Throws:
IllegalArgumentException- if the specified collection or range is empty.- See Also:
-
max
public static <T extends Comparable<? super T>> T max(Iterable<? extends T> c) throws IllegalArgumentException Returns the biggest element in the specified iterable based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of the objects being compared, which must be comparable.- Parameters:
c- the iterable of comparable objects to be compared.- Returns:
- the biggest element in the iterable.
- Throws:
IllegalArgumentException- if the specified iterable isnullor empty.- See Also:
-
max
public static <T> T max(Iterable<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException Returns the biggest element in the specified iterable according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
c- the iterable of objects to be compared.cmp- the comparator to be used to compare the objects- Returns:
- the biggest element in the iterable.
- Throws:
IllegalArgumentException- if the specified iterable isnullor empty.- See Also:
-
max
public static <T extends Comparable<? super T>> T max(Iterator<? extends T> iter) throws IllegalArgumentException Returns the biggest element in the specified iterator based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of the objects being compared, which must be comparable.- Parameters:
iter- the iterator of comparable objects to be compared.- Returns:
- the biggest element in the iterator.
- Throws:
IllegalArgumentException- if the specified iterator isnullor empty.- See Also:
-
max
public static <T> T max(Iterator<? extends T> iter, Comparator<? super T> cmp) throws IllegalArgumentException Returns the biggest element in the specified iterator according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
iter- the iterator of objects to be compared.cmp- the comparator to be used to compare the objects- Returns:
- the biggest element in the iterator.
- Throws:
IllegalArgumentException- if the specified iterator isnullor empty.- See Also:
-
maxAll
Returns a list containing the biggest elements in the specified array based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input array, which must be comparable.- Parameters:
a- the array to fetch the biggest elements.- Returns:
- a list containing the biggest elements in the array. If the array is
nullor empty, an empty list is returned.
-
maxAll
Returns a list containing all biggest elements in the specified array according to the provided comparator.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to fetch the biggest elements from.cmp- the comparator to be used to compare the elements- Returns:
- a list containing all biggest elements in the array. If the array is
nullor empty, an empty list is returned.
-
maxAll
Returns a list containing the biggest elements in the specified iterable based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input iterable, which must be comparable.- Parameters:
a- the iterable to fetch the biggest elements.- Returns:
- a list containing the biggest elements in the iterable. If the iterable is
nullor empty, an empty list is returned.
-
maxAll
Returns a list containing all biggest elements in the specified iterable according to the provided comparator.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
cmp- the comparator to be used to compare the elementsa- the iterable to fetch the biggest elements from.- Returns:
- a list containing all biggest elements in the iterable. If the iterable is
nullor empty, an empty list is returned.
-
maxAll
Returns a list containing the biggest elements in the specified iterator based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input iterator, which must be comparable.- Parameters:
a- the iterator to fetch the biggest elements.- Returns:
- a list containing the biggest elements in the iterator. If the iterator is
nullor empty, an empty list is returned.
-
maxAll
Returns a list containing all biggest elements in the specified iterator according to the provided comparator.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
cmp- the comparator to be used to compare the elementsa- the iterator to fetch the biggest elements from.- Returns:
- a list containing all biggest elements in the iterator. If the iterator is
nullor empty, an empty list is returned.
-
maxOrDefaultIfEmpty
@Beta public static <T,R extends Comparable<? super R>> R maxOrDefaultIfEmpty(T[] a, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified array or a default value if the array isnullor empty. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input array.R- the type of the extracted value, which must be comparable.- Parameters:
a- the array to extract the maximum value from.valueExtractor- the function to extract values from the array elements for comparison.defaultValue- the default value to return if the array isnullor empty.- Returns:
- the maximum extracted value or the default value if the array is
nullor empty.
-
maxOrDefaultIfEmpty
public static <T,R extends Comparable<? super R>> R maxOrDefaultIfEmpty(Iterable<? extends T> c, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified iterable or a default value if the iterable isnullor empty. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input iterable.R- the type of the extracted value, which must be comparable.- Parameters:
c- the iterable to extract the maximum value from.valueExtractor- the function to extract values from the iterable elements for comparison.defaultValue- the default value to return if the iterable isnullor empty.- Returns:
- the maximum extracted value or the default value if the iterable is
nullor empty.
-
maxOrDefaultIfEmpty
public static <T,R extends Comparable<? super R>> R maxOrDefaultIfEmpty(Iterator<? extends T> iter, Function<? super T, ? extends R> valueExtractor, R defaultValue) Returns the maximum value extracted from the specified iterator or a default value if the iterator isnullor empty. Null values are considered to be minimum here.- Type Parameters:
T- the type of elements in the input iterator.R- the type of the extracted value, which must be comparable.- Parameters:
iter- the iterator to extract the maximum value from.valueExtractor- the function to extract values from the iterator elements for comparison.defaultValue- the default value to return if the iterator isnullor empty.- Returns:
- the maximum extracted value or the default value if the iterator is
nullor empty.
-
maxIntOrDefaultIfEmpty
@Beta public static <T> int maxIntOrDefaultIfEmpty(T[] a, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximum integer value extracted from the array or a default value if the array isnullor empty.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to extract the maximum integer from.valueExtractor- the function to extract integer values from the array elements.defaultValue- the default value to return if the array isnullor empty.- Returns:
- the maximum extracted integer value or the default value if the array is
nullor empty.
-
maxIntOrDefaultIfEmpty
@Beta public static <T> int maxIntOrDefaultIfEmpty(Iterable<? extends T> c, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximum integer value extracted from the iterable or a default value if the iterable isnullor empty.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to extract the maximum integer from.valueExtractor- the function to extract integer values from the iterable elements.defaultValue- the default value to return if the iterable isnullor empty.- Returns:
- the maximum extracted integer value or the default value if the iterable is
nullor empty.
-
maxIntOrDefaultIfEmpty
@Beta public static <T> int maxIntOrDefaultIfEmpty(Iterator<? extends T> iter, ToIntFunction<? super T> valueExtractor, int defaultValue) Returns the maximum integer value extracted from the iterator or a default value if the iterator isnullor empty.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to extract the maximum integer from.valueExtractor- the function to extract integer values from the iterator elements.defaultValue- the default value to return if the iterator isnullor empty.- Returns:
- the maximum extracted integer value or the default value if the iterator is
nullor empty.
-
maxLongOrDefaultIfEmpty
@Beta public static <T> long maxLongOrDefaultIfEmpty(T[] a, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximum long value extracted from the array or a default value if the array isnullor empty.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to extract the maximum long from.valueExtractor- the function to extract long values from the array elements.defaultValue- the default value to return if the array isnullor empty.- Returns:
- the maximum extracted long value or the default value if the array is
nullor empty.
-
maxLongOrDefaultIfEmpty
@Beta public static <T> long maxLongOrDefaultIfEmpty(Iterable<? extends T> c, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximum long value extracted from the iterable or a default value if the iterable isnullor empty.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to extract the maximum long from.valueExtractor- the function to extract long values from the iterable elements.defaultValue- the default value to return if the iterable isnullor empty.- Returns:
- the maximum extracted long value or the default value if the iterable is
nullor empty.
-
maxLongOrDefaultIfEmpty
@Beta public static <T> long maxLongOrDefaultIfEmpty(Iterator<? extends T> iter, ToLongFunction<? super T> valueExtractor, long defaultValue) Returns the maximum long value extracted from the iterator or a default value if the iterator isnullor empty.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to extract the maximum long from.valueExtractor- the function to extract long values from the iterator elements.defaultValue- the default value to return if the iterator isnullor empty.- Returns:
- the maximum extracted long value or the default value if the iterator is
nullor empty.
-
maxDoubleOrDefaultIfEmpty
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(T[] a, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximum double value extracted from the array or a default value if the array isnullor empty.- Type Parameters:
T- the type of elements in the input array.- Parameters:
a- the array to extract the maximum double from.valueExtractor- the function to extract double values from the array elements.defaultValue- the default value to return if the array isnullor empty.- Returns:
- the maximum extracted double value or the default value if the array is
nullor empty.
-
maxDoubleOrDefaultIfEmpty
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(Iterable<? extends T> c, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximum double value extracted from the iterable or a default value if the iterable isnullor empty.- Type Parameters:
T- the type of elements in the input iterable.- Parameters:
c- the iterable to extract the maximum double from.valueExtractor- the function to extract double values from the iterable elements.defaultValue- the default value to return if the iterable isnullor empty.- Returns:
- the maximum extracted double value or the default value if the iterable is
nullor empty.
-
maxDoubleOrDefaultIfEmpty
@Beta public static <T> double maxDoubleOrDefaultIfEmpty(Iterator<? extends T> iter, ToDoubleFunction<? super T> valueExtractor, double defaultValue) Returns the maximum double value extracted from the iterator or a default value if the iterator isnullor empty.- Type Parameters:
T- the type of elements in the input iterator.- Parameters:
iter- the iterator to extract the maximum double from.valueExtractor- the function to extract double values from the iterator elements.defaultValue- the default value to return if the iterator isnullor empty.- Returns:
- the maximum extracted double value or the default value if the iterator is
nullor empty.
-
median
public static char median(char a, char b, char c) Returns the median value of the three specified char values.- Parameters:
a- the first char value.b- the second char value.c- the third char value.- Returns:
- the median of the three specified char values.
- See Also:
-
median
public static byte median(byte a, byte b, byte c) Returns the median value of the three specified byte values.- Parameters:
a- the first byte value.b- the second byte value.c- the third byte value.- Returns:
- the median of the three specified byte values.
- See Also:
-
median
public static short median(short a, short b, short c) Returns the median value of the three specified short values.- Parameters:
a- the first short value.b- the second short value.c- the third short value.- Returns:
- the median of the three specified short values.
- See Also:
-
median
public static int median(int a, int b, int c) Returns the median value of the three specified int values.- Parameters:
a- the first int value.b- the second int value.c- the third int value.- Returns:
- the median of the three specified int values.
- See Also:
-
median
public static long median(long a, long b, long c) Returns the median value of the three specified long values.- Parameters:
a- the first long value.b- the second long value.c- the third long value.- Returns:
- the median of the three specified long values.
- See Also:
-
median
public static float median(float a, float b, float c) Returns the median value of the three specified float values.- Parameters:
a- the first float value.b- the second float value.c- the third float value.- Returns:
- the median of the three specified float values.
- See Also:
-
median
public static double median(double a, double b, double c) Returns the median value of the three specified double values.- Parameters:
a- the first double value.b- the second double value.c- the third double value.- Returns:
- the median of the three specified double values.
- See Also:
-
median
Returns the median of the provided values based on their natural ordering. Null values are considered to be minimum here.- Type Parameters:
T- the type of the objects being compared, which must be comparable.- Parameters:
a- the first value.b- the second value.c- the third value.- Returns:
- the median of the three specified values.
- See Also:
-
median
Returns the median of the provided values according to the provided comparator.- Type Parameters:
T- the type of the objects being compared.- Parameters:
a- the first value.b- the second value.c- the third value.cmp- the comparator to be used to compare the objects- Returns:
- the median of the three specified values.
- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest value in the specified array.- Parameters:
a- the array of values to find the median of- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty- See Also:
-
median
public static char median(char[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the range- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest value in the specified array.- Parameters:
a- the array of values to find the median of- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty- See Also:
-
median
public static byte median(byte[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the range- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest value in the specified array.- Parameters:
a- the array of values to find the median of- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty- See Also:
-
median
public static short median(short[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the range- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest value in the specified array.N.media([1]) => 1 N.media([1, 2]) => 1 N.media([2, 1]) => 1 N.media([1, 2, 3]) => 2 N.media([1, 3, 2]) => 2 N.media([1, 2, 3, 4]) => 2 N.media([1, 3, 2, 4]) => 2- Parameters:
a- the array of values to find the median of- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty
-
median
public static int median(int[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the range- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest value in the specified array.- Parameters:
a- the array of values to find the median of- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty- See Also:
-
median
public static long median(long[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the range- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest value in the specified array.- Parameters:
a- the array of values to find the median of- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty- See Also:
-
median
public static float median(float[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the range- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest value in the specified array.- Parameters:
a- the array of values to find the median of- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty- See Also:
-
median
public static double median(double[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the range- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest value in the specified array.- Parameters:
a- the array of values to find the median of- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty- See Also:
-
median
public static <T extends Comparable<? super T>> T median(T[] a, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest value within the given range in the specified array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the range- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
Returns the(sizeOfRange / 2 + 1)largest element in the specified array according to the provided comparator.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array of values to find the median ofcmp- the comparator to determine the order of the values- Returns:
- the median in the specified array
- Throws:
IllegalArgumentException- if the array isnullor empty- See Also:
-
median
public static <T> T median(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest element within the specified range in the input array according to the provided comparator.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array of values to find the median offromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangecmp- the comparator to determine the order of the values- Returns:
- the median within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array or range isnullor emptyIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
median
public static <T extends Comparable<? super T>> T median(Collection<? extends T> c) throws IllegalArgumentException Returns the(sizeOfRange / 2 + 1)largest element in the specified collection according to the provided comparator.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the collection of values to find the median ofcmp- the comparator to determine the order of the values- Returns:
- the median in the specified collection
- Throws:
IllegalArgumentException- if the collection isnullor empty- See Also:
-
median
public static <T extends Comparable<? super T>> T median(Collection<? extends T> c, int fromIndex, int toIndex) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest element within the specified range in the input collection according to the provided comparator.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the collection of values to find the median offromIndex- The start index (inclusive) of the range to consider in the collectiontoIndex- the end index (exclusive) of the range to consider in the collectioncmp- the comparator to determine the order of the values- Returns:
- the median within the specified range in the input collection
- Throws:
IllegalArgumentException- if the specified collection or range isnullor emptyIndexOutOfBoundsException- if the range is out of the collection bounds- See Also:
-
median
public static <T> T median(Collection<? extends T> c, Comparator<? super T> cmp) throws IndexOutOfBoundsException, IllegalArgumentException Returns the(sizeOfRange / 2 + 1)largest element in the specified collection according to the provided comparator.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the collection of values to find the median ofcmp- the comparator to determine the order of the values- Returns:
- the median in the specified collection
- Throws:
IllegalArgumentException- if the collection isnullor emptyIndexOutOfBoundsException- See Also:
-
median
public static <T> T median(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the(sizeOfRange / 2 + 1)largest element within the specified range in the input collection according to the provided comparator.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the collection of values to find the median offromIndex- The start index (inclusive) of the range to consider in the collectiontoIndex- the end index (exclusive) of the range to consider in the collectioncmp- the comparator to determine the order of the values- Returns:
- the median within the specified range in the input collection
- Throws:
IllegalArgumentException- if the specified collection or range isnullor emptyIndexOutOfBoundsException- if the range is out of the collection bounds- See Also:
-
kthLargest
Returns the k-th largest element in the specified array.- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to find- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static char kthLargest(char[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array.- Parameters:
a- the array to find the k-th largest element infromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- the position (1-based) of the largest element to find- Returns:
- the k-th largest element within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
kthLargest
Returns the k-th largest element in the specified array.- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to find- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static byte kthLargest(byte[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array.- Parameters:
a- the array to find the k-th largest element infromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- the position (1-based) of the largest element to find- Returns:
- the k-th largest element within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
kthLargest
Returns the k-th largest element in the specified array.- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to find- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static short kthLargest(short[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array.- Parameters:
a- the array to find the k-th largest element infromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- the position (1-based) of the largest element to find- Returns:
- the k-th largest element within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
kthLargest
Returns the k-th largest element in the specified array.- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to find- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static int kthLargest(int[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array.- Parameters:
a- the array to find the k-th largest element infromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- the position (1-based) of the largest element to find- Returns:
- the k-th largest element within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
kthLargest
Returns the k-th largest element in the specified array.- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to find- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static long kthLargest(long[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array.- Parameters:
a- the array to find the k-th largest element infromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- the position (1-based) of the largest element to find- Returns:
- the k-th largest element within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
kthLargest
Returns the k-th largest element in the specified array.- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to find- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static float kthLargest(float[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array.- Parameters:
a- the array to find the k-th largest element infromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- the position (1-based) of the largest element to find- Returns:
- the k-th largest element within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
kthLargest
Returns the k-th largest element in the specified array.- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to find- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static double kthLargest(double[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array.- Parameters:
a- the array to find the k-th largest element infromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- the position (1-based) of the largest element to find- Returns:
- the k-th largest element within the specified range in the input array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- if the range is out of the array bounds- See Also:
-
kthLargest
public static <T extends Comparable<? super T>> T kthLargest(T[] a, int k) throws IllegalArgumentException Returns the k-th largest element in the specified array.- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to find- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static <T extends Comparable<? super T>> T kthLargest(T[] a, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array.- Type Parameters:
T- The type of the elements in the array. It must be a type that implements Comparable.- Parameters:
a- The array from which to find the k-th largest element.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- The position from the largest element to return.- Returns:
- The kth largest element from the array.
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- See Also:
-
kthLargest
public static <T> T kthLargest(T[] a, int k, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element in the specified array according to the provided comparator.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array to find the k-th largest element ink- the position (1-based) of the largest element to findcmp- the comparator to determine the order of the array- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- See Also:
-
kthLargest
public static <T> T kthLargest(T[] a, int fromIndex, int toIndex, int k, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input array according to the provided comparator.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array from which to find the k-th largest element.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- The position from the largest element to return.cmp- The comparator to determine the order of the array.- Returns:
- The kth largest element from the array.
- Throws:
IllegalArgumentException- if the specified array/range isnullor empty, its length is less than kIndexOutOfBoundsException- See Also:
-
kthLargest
public static <T extends Comparable<? super T>> T kthLargest(Collection<? extends T> c, int k) throws IllegalArgumentException Returns the k-th largest element in the specified collection.- Parameters:
k- the position (1-based) of the largest element to finda- the collection to find the k-th largest element in- Returns:
- the k-th largest element in the array
- Throws:
IllegalArgumentException- if the specified collection/range isnullor empty, its length is less than k- See Also:
-
kthLargest
public static <T extends Comparable<? super T>> T kthLargest(Collection<? extends T> c, int fromIndex, int toIndex, int k) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input collection.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection from which to find the k-th largest element.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- The position from the largest element to return.- Returns:
- The kth largest element from the collection.
- Throws:
IllegalArgumentException- if the specified collection/range isnullor empty, its length is less than kIndexOutOfBoundsException- See Also:
-
kthLargest
public static <T> T kthLargest(Collection<? extends T> c, int k, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element in the specified collection according to the provided comparator.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the collection to find the k-th largest element ink- the position (1-based) of the largest element to findcmp- the comparator to determine the order of the collection- Returns:
- the k-th largest element in the collection
- Throws:
IllegalArgumentException- if the specified collection/range isnullor empty, its length is less than kIndexOutOfBoundsException- See Also:
-
kthLargest
public static <T> T kthLargest(Collection<? extends T> c, int fromIndex, int toIndex, int k, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the k-th largest element within the specified range in the input collection according to the provided comparator.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection from which to find the k-th largest element.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangek- The position from the largest element to return.cmp- The comparator to determine the order of the collection.- Returns:
- The kth largest element from the collection.
- Throws:
IllegalArgumentException- if the specified collection/range isnullor empty, its length is less than kIndexOutOfBoundsException- See Also:
-
top
public static short[] top(short[] a, int n) Returns the top n elements from the specified array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to return- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
Returns the top n elements from the specified array according to the provided comparator. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to returncmp- the comparator to determine the order of the array- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static short[] top(short[] a, int fromIndex, int toIndex, int n) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static short[] top(short[] a, int fromIndex, int toIndex, int n, Comparator<? super Short> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array according to the provided comparator. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.cmp- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static int[] top(int[] a, int n) Returns the top n elements from the specified array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to return- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.
-
top
Returns the top n elements from the specified array according to the provided comparator. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to returncmp- the comparator to determine the order of the array- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.
-
top
public static int[] top(int[] a, int fromIndex, int toIndex, int n) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static int[] top(int[] a, int fromIndex, int toIndex, int n, Comparator<? super Integer> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array according to the provided comparator. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.cmp- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static long[] top(long[] a, int n) Returns the top n elements from the specified array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to return- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
Returns the top n elements from the specified array according to the provided comparator. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to returncmp- the comparator to determine the order of the array- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static long[] top(long[] a, int fromIndex, int toIndex, int n) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static long[] top(long[] a, int fromIndex, int toIndex, int n, Comparator<? super Long> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array according to the provided comparator. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.cmp- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static float[] top(float[] a, int n) Returns the top n elements from the specified array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to return- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
Returns the top n elements from the specified array according to the provided comparator. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to returncmp- the comparator to determine the order of the array- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static float[] top(float[] a, int fromIndex, int toIndex, int n) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static float[] top(float[] a, int fromIndex, int toIndex, int n, Comparator<? super Float> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array according to the provided comparator. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.cmp- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static double[] top(double[] a, int n) Returns the top n elements from the specified array. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to return- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
Returns the top n elements from the specified array according to the provided comparator. If there are less than n elements in the array, a copy of the input array is returned.- Parameters:
a- the array to find the top n elements inn- the number of top elements to returncmp- the comparator to determine the order of the array- Returns:
- an array containing the top n elements
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static double[] top(double[] a, int fromIndex, int toIndex, int n) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static double[] top(double[] a, int fromIndex, int toIndex, int n, Comparator<? super Double> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from a specified range in the input array according to the provided comparator. If there are less than n elements within the specified range, all the elements from the range will be included in the returned array.- Parameters:
a- the array to select the top elements from.fromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.n- the number of top elements to select.cmp- the comparator to determine the order of the array.- Returns:
- a array containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
Returns the top n elements from the specified array based on their natural ordering. Null values are considered as the smallest elements here. If there are less than n elements in the array, all the elements will be included to returned list.- Type Parameters:
T- The type of the elements in the array. It must be a type that implements Comparable.- Parameters:
a- The array from which to find the top n elements.n- The number of top elements to return.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
Returns the top n elements from the specified array according to the provided comparator. If there are less than n elements in the array, all the elements will be included to returned list.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array from which to find the top n elements.n- The number of top elements to return.cmp- The Comparator to determine the order of the elements.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static <T extends Comparable<? super T>> List<T> top(T[] a, int fromIndex, int toIndex, int n) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from the specified range in the input array based on their natural ordering. Null values are considered as the smallest elements here. If there are less than n elements in the range specified byfromIndexandtoIndex, all the elements from that range will be included to returned list.- Type Parameters:
T- The type of the elements in the array. It must be a type that implements Comparable.- Parameters:
a- The array from which to find the top n elements.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangen- The number of top elements to return.- Returns:
- A list containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static <T> List<T> top(T[] a, int fromIndex, int toIndex, int n, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from the specified range in the input array according to the provided comparator. If there are less than n elements in the range, all the elements from that range will be included in the returned list.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array from which to find the top n elements.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangen- The number of top elements to return.cmp- The comparator to determine the order of the elements.- Returns:
- A list containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
Returns the top n elements from the specified collection based on their natural ordering. Null values are considered as the smallest elements here. If there are less than n elements in the collection, all the elements will be included to returned list.- Type Parameters:
T- The type of the elements in the collection. It must be a type that implements Comparable.- Parameters:
n- The number of top elements to return.a- The collection from which to find the top n elements.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
Returns the top n elements from the specified collection according to the provided comparator. If there are less than n elements in the collection, all the elements will be included to returned list.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
n- The number of top elements to return.cmp- The comparator to determine the order of the elements.a- The collection from which to find the top n elements.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static <T extends Comparable<? super T>> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from the specified range in the input collection based on their natural ordering. Null values are considered as the smallest elements here. If there are less than n elements in the range specified byfromIndexandtoIndex, all the elements from that range will be included to returned list.- Type Parameters:
T- The type of the elements in the collection. It must be a type that implements Comparable.- Parameters:
fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangen- The number of top elements to return.a- The collection from which to find the top n elements.- Returns:
- A list containing the top n elements from the specified range in the input collection.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the collection's bounds.- See Also:
-
top
public static <T> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from the specified range in the input collection according to the provided comparator. If there are less than n elements in the range, all the elements from that range will be included in the returned list.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangen- The number of top elements to return.cmp- The comparator to determine the order of the elements.a- The collection from which to find the top n elements.- Returns:
- A list containing the top n elements from the specified range in the input collection.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the collection's bounds.- See Also:
-
top
public static <T extends Comparable<? super T>> List<T> top(T[] a, int n, boolean keepEncounterOrder) Returns the top n elements from the specified array based on their natural ordering. Null values are considered as the smallest elements here. If there are less than n elements in the array, all the elements will be included to returned list. The order of the elements in the returned list is based on their encounter order in the array if keepEncounterOrder istrue.- Type Parameters:
T- The type of the elements in the array. It must be a type that implements Comparable.- Parameters:
a- The array from which to find the top n elements.n- The number of top elements to return.keepEncounterOrder- If it'strue, the encounter order of the elements in the array is preserved in the returned list.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
Returns the top n elements from the specified array according to the provided comparator. If there are less than n elements in the array, all the elements will be included to returned list. The order of the elements in the returned list is based on their encounter order in the array if keepEncounterOrder istrue.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array from which to find the top n elements.n- The number of top elements to return.cmp- The comparator to determine the order of the elements.keepEncounterOrder- If it'strue, the encounter order of the elements in the array is preserved in the returned list.- Returns:
- A list containing the top n elements from the array.
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static <T extends Comparable<? super T>> List<T> top(T[] a, int fromIndex, int toIndex, int n, boolean keepEncounterOrder) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from the specified range in the input array based on their natural ordering. Null values are considered as the smallest elements here. If there are less than n elements in the range specified byfromIndexandtoIndex, all the elements from that range will be included to returned list. The order of the elements in the returned list is based on their encounter order in the array if keepEncounterOrder istrue.- Type Parameters:
T- The type of the elements in the array. It must be a type that implements Comparable.- Parameters:
a- The array from which to find the top n elements.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangen- The number of top elements to return.keepEncounterOrder- If it'strue, the encounter order of the elements in the array is preserved in the returned list.- Returns:
- A list containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static <T> List<T> top(T[] a, int fromIndex, int toIndex, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from the specified range in the input array according to the provided comparator. If there are less than n elements in the range, all the elements from that range will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the array if keepEncounterOrder istrue.- Type Parameters:
T- The type of the elements in the array.- Parameters:
a- The array from which to find the top n elements.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangen- The number of top elements to return.cmp- The comparator to determine the order of the elements.keepEncounterOrder- If it'strue, the encounter order of the elements in the array is preserved in the returned list.- Returns:
- A list containing the top n elements from the specified range in the input array.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
top
public static <T extends Comparable<? super T>> List<T> top(Collection<? extends T> c, int n, boolean keepEncounterOrder) Returns the top n elements from the specified collection based on their natural ordering. Null values are considered as the smallest elements here. If there are less than n elements in the collection, all the elements will be included to returned list. The order of the elements in the returned list is based on their encounter order in the collection if keepEncounterOrder istrue.- Type Parameters:
T- The type of the elements in the collection. The type must be a subclass ofComparable.- Parameters:
c- The collection from which to find the top n elements.n- The number of top elements to return.keepEncounterOrder- If it'strue, the encounter order of the elements in the collection is preserved in the returned list.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static <T> List<T> top(Collection<? extends T> c, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) Returns the top n elements from the specified collection according to the provided comparator. If there are less than n elements in the collection, all the elements will be included to returned list. The order of the elements in the returned list is based on their encounter order in the collection if keepEncounterOrder istrue.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection from which to find the top n elements.n- The number of top elements to return.cmp- The comparator to determine the order of the elements.keepEncounterOrder- If it'strue, the encounter order of the elements in the collection is preserved in the returned list.- Returns:
- A list containing the top n elements from the collection.
- Throws:
IllegalArgumentException- if the specified n is negative.- See Also:
-
top
public static <T extends Comparable<? super T>> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, boolean keepEncounterOrder) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from the specified range in the input collection based on their natural ordering. Null values are considered as the smallest elements here. If there are less than n elements in the range specified byfromIndexandtoIndex, all the elements from that range will be included to returned list. The order of the elements in the returned list is based on their encounter order in the collection if keepEncounterOrder istrue.- Type Parameters:
T- The type of the elements in the collection. The type must be a subclass ofComparable.- Parameters:
c- The collection from which to find the top n elements.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangen- The number of top elements to return.keepEncounterOrder- If it'strue, the encounter order of the elements in the collection is preserved in the returned list.- Returns:
- A list containing the top n elements from the specified range in the input collection.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the collection's bounds.- See Also:
-
top
public static <T> List<T> top(Collection<? extends T> c, int fromIndex, int toIndex, int n, Comparator<? super T> cmp, boolean keepEncounterOrder) throws IllegalArgumentException, IndexOutOfBoundsException Returns the top n elements from the specified range in the input collection according to the provided comparator. If there are less than n elements in the range, all the elements from that range will be included in the returned list. The order of the elements in the returned list is based on their encounter order in the collection if keepEncounterOrder istrue.- Type Parameters:
T- The type of the elements in the collection.- Parameters:
c- The collection from which to find the top n elements.fromIndex- The start index (inclusive) of the rangetoIndex- the end index (exclusive) of the rangen- The number of top elements to return.cmp- The comparator to determine the order of the elements.keepEncounterOrder- If it'strue, the encounter order of the elements in the collection is preserved in the returned list.- Returns:
- A list containing the top n elements from the specified range in the input collection.
- Throws:
IllegalArgumentException- if the specified n is negative.IndexOutOfBoundsException- if the specified range is out of the collection's bounds.- See Also:
-
percentiles
public static Map<Percentage,Character> percentiles(char[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of characters.- Parameters:
sortedArray- The sorted array of characters for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding characters from the array.
- Throws:
IllegalArgumentException- if the provided array is empty.- See Also:
-
percentiles
Calculates the percentiles of the provided sorted array of bytes.- Parameters:
sortedArray- The sorted array of bytes for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding bytes from the array.
- Throws:
IllegalArgumentException- if the provided array is empty.- See Also:
-
percentiles
public static Map<Percentage,Short> percentiles(short[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of shorts.- Parameters:
sortedArray- The sorted array of shorts for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding shorts from the array.
- Throws:
IllegalArgumentException- if the provided array is empty.- See Also:
-
percentiles
public static Map<Percentage,Integer> percentiles(int[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of integers.final int[] sortedArray = Array.range(1, 101); final Mapinvalid input: '<'Percentage, Integer> percentiles = N.percentiles(a); percentiles.forEach(Fn.println("=")); 0.0001%=1 0.001%=1 0.01%=1 0.1%=1 1%=2 2%=3 3%=4 4%=5 5%=6 6%=7 7%=8 8%=9 9%=10 10%=11 20%=21 30%=31 40%=41 50%=51 60%=61 70%=71 80%=81 90%=91 91%=92 92%=93 93%=94 94%=95 95%=96 96%=97 97%=98 98%=99 99%=100 99.9%=100 99.99%=100 99.999%=100 99.9999%=100- Parameters:
sortedArray- The sorted array of integers for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding integers from the array.
- Throws:
IllegalArgumentException- if the provided array is empty.
-
percentiles
Calculates the percentiles of the provided sorted array of longs.- Parameters:
sortedArray- The sorted array of longs for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding longs from the array.
- Throws:
IllegalArgumentException- if the provided array is empty.- See Also:
-
percentiles
public static Map<Percentage,Float> percentiles(float[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of floats.- Parameters:
sortedArray- The sorted array of floats for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding floats from the array.
- Throws:
IllegalArgumentException- if the provided array is empty.- See Also:
-
percentiles
public static Map<Percentage,Double> percentiles(double[] sortedArray) throws IllegalArgumentException Calculates the percentiles of the provided sorted array of doubles.- Parameters:
sortedArray- The sorted array of doubles for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding doubles from the array.
- Throws:
IllegalArgumentException- if the provided array is empty.- See Also:
-
percentiles
Calculates the percentiles of the provided sorted array.- Type Parameters:
T- The type of elements in the array.- Parameters:
sortedArray- The array for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding elements from the array.
- Throws:
IllegalArgumentException- if the provided array isnullor empty.- See Also:
-
percentiles
Calculates the percentiles of the provided sorted list.- Type Parameters:
T- The type of elements in the list.- Parameters:
sortedList- The sorted list for which to calculate the percentiles.- Returns:
- A map where the keys are the percentiles and the values are the corresponding elements from the list.
- Throws:
IllegalArgumentException- if the provided list isnullor empty.- See Also:
-
filter
Returns a new array containing only the elements that match the filter predicate. An empty array is returned if the input array is empty.- Parameters:
a- the array of boolean values to be filteredfilter- the predicate used to filter the array- Returns:
- a new array containing only the elements that match the filter predicate
- See Also:
-
filter
public static boolean[] filter(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter) throws IndexOutOfBoundsException Returns a new array containing only the elements that match the filter predicate within the specified range in the input array. An empty array is returned if the input array/range is empty.- Parameters:
a- the array of characters to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a a new array containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
Returns a new array containing only the elements that match the filter predicate. An empty array is returned if the input array is empty.- Parameters:
a- the array of characters to be filteredfilter- the predicate used to filter the array- Returns:
- a new array containing only the elements that match the filter predicate
- See Also:
-
filter
public static char[] filter(char[] a, int fromIndex, int toIndex, CharPredicate filter) throws IndexOutOfBoundsException Returns a new array containing only the elements that match the filter predicate within the specified range in the input array. An empty array is returned if the input array/range is empty.- Parameters:
a- the array of characters to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a a new array containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
Returns a new array containing only the elements that match the filter predicate. An empty array is returned if the input array is empty.- Parameters:
a- the array of bytes to be filteredfilter- the predicate used to filter the array- Returns:
- a new array containing only the elements that match the filter predicate
- See Also:
-
filter
public static byte[] filter(byte[] a, int fromIndex, int toIndex, BytePredicate filter) throws IndexOutOfBoundsException Returns a new array containing only the elements that match the filter predicate within the specified range in the input array. An empty array is returned if the input array/range is empty.- Parameters:
a- the array of bytes to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a a new array containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
Returns a new array containing only the elements that match the filter predicate. An empty array is returned if the input array is empty.- Parameters:
a- the array of short values to be filteredfilter- the predicate used to filter the array- Returns:
- a new array containing only the elements that match the filter predicate
- See Also:
-
filter
public static short[] filter(short[] a, int fromIndex, int toIndex, ShortPredicate filter) throws IndexOutOfBoundsException Returns a new array containing only the elements that match the filter predicate within the specified range in the input array. An empty array is returned if the input array/range is empty.- Parameters:
a- the array of short values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a a new array containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
Returns a new array containing only the elements that match the filter predicate. An empty array is returned if the input array is empty.- Parameters:
a- the array of int values to be filteredfilter- the predicate used to filter the array- Returns:
- a new array containing only the elements that match the filter predicate
- See Also:
-
filter
public static int[] filter(int[] a, int fromIndex, int toIndex, IntPredicate filter) throws IndexOutOfBoundsException Returns a new array containing only the elements that match the filter predicate within the specified range in the input array. An empty array is returned if the input array/range is empty.- Parameters:
a- the array of int values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a a new array containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
Returns a new array containing only the elements that match the filter predicate. An empty array is returned if the input array is empty.- Parameters:
a- the array of long values to be filteredfilter- the predicate used to filter the array- Returns:
- a new array containing only the elements that match the filter predicate
- See Also:
-
filter
public static long[] filter(long[] a, int fromIndex, int toIndex, LongPredicate filter) throws IndexOutOfBoundsException Returns a new array containing only the elements that match the filter predicate within the specified range in the input array. An empty array is returned if the input array/range is empty.- Parameters:
a- the array of long values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a a new array containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
Returns a new array containing only the elements that match the filter predicate. An empty array is returned if the input array is empty.- Parameters:
a- the array of float values to be filteredfilter- the predicate used to filter the array- Returns:
- a new array containing only the elements that match the filter predicate
- See Also:
-
filter
public static float[] filter(float[] a, int fromIndex, int toIndex, FloatPredicate filter) throws IndexOutOfBoundsException Returns a new array containing only the elements that match the filter predicate within the specified range in the input array. An empty array is returned if the input array/range is empty.- Parameters:
a- the array of float values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a a new array containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
Returns a new array containing only the elements that match the filter predicate. An empty array is returned if the input array is empty.- Parameters:
a- the array of double values to be filteredfilter- the predicate used to filter the array- Returns:
- a new array containing only the elements that match the filter predicate
- See Also:
-
filter
public static double[] filter(double[] a, int fromIndex, int toIndex, DoublePredicate filter) throws IndexOutOfBoundsException Returns a new array containing only the elements that match the filter predicate within the specified range in the input array. An empty array is returned if the input array/range is empty.- Parameters:
a- the array of double values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a a new array containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
Returns a new list containing only the elements that match the filter predicate. An empty list is returned if the input array is empty.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be filteredfilter- the predicate used to filter the array- Returns:
- a new list containing only the elements that match the filter predicate
- See Also:
-
filter
public static <T,C extends Collection<T>> C filter(T[] a, Predicate<? super T> filter, IntFunction<C> supplier) throws IndexOutOfBoundsException Returns a new collection containing only the elements that match the filter predicate. An empty collection is returned if the input array is empty. The collection is created by the provided supplier function.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be filteredfilter- the predicate used to filter the arraysupplier- the supplier function that provides a new collection to store the filtered elements- Returns:
- a new collection containing only the elements that match the filter predicate
- Throws:
IndexOutOfBoundsException- See Also:
-
filter
public static <T> List<T> filter(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter) throws IndexOutOfBoundsException Returns a new list containing only the elements that match the filter predicate within the specified range in the input array. An empty list is returned if the input array/range is empty.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the array- Returns:
- a new list containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
public static <T,C extends Collection<T>> C filter(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter, IntFunction<C> supplier) throws IndexOutOfBoundsException Returns a new collection containing only the elements that match the filter predicate within the specified range in the input array. An empty collection is returned if the input array/range is empty. The collection is created by the provided supplier function.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the arraysupplier- the supplier function that provides a new collection to store the filtered elements- Returns:
- a new collection containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the array's bounds.- See Also:
-
filter
public static <T> List<T> filter(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter) throws IndexOutOfBoundsException Returns a new list containing only the elements that match the filter predicate within the specified range in the input collection. An empty list is returned if the input collection/range is empty.- Type Parameters:
T- the type of the elements in the collection- Parameters:
c- the collection of values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the collection- Returns:
- a new list containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the collection's bounds.- See Also:
-
filter
public static <T,C extends Collection<T>> C filter(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter, IntFunction<C> supplier) throws IndexOutOfBoundsException Returns a new collection containing only the elements that match the filter predicate within the specified range in the input collection. An empty collection is returned if the input collection/range is empty. The collection is created by the provided supplier function.- Type Parameters:
T- the type of the elements in the collection- Parameters:
c- the collection of values to be filteredfromIndex- The start index (inclusive) of the range.toIndex- The end index (exclusive) of the range.filter- the predicate used to filter the collectionsupplier- the supplier function that provides a new collection to store the filtered elements- Returns:
- a new collection containing only the elements that match the filter predicate within the specified range
- Throws:
IndexOutOfBoundsException- if the specified range is out of the collection's bounds.- See Also:
-
filter
Returns a new list containing only the elements that match the filter predicate. An empty list is returned if the input collection is empty.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable of values to be filteredfilter- the predicate used to filter the iterable- Returns:
- a new list containing only the elements that match the filter predicate
- See Also:
-
filter
public static <T,C extends Collection<T>> C filter(Iterable<? extends T> c, Predicate<? super T> filter, IntFunction<C> supplier) Returns a new collection containing only the elements that match the filter predicate. An empty collection is returned if the input collection is empty. The collection is created by the provided supplier function.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable of values to be filteredfilter- the predicate used to filter the iterablesupplier- the supplier function that provides a new collection to store the filtered elements- Returns:
- a new collection containing only the elements that match the filter predicate
- See Also:
-
filter
Returns a new list containing only the elements that match the filter predicate. An empty list is returned if the input iterator is empty.- Type Parameters:
T- the type of the elements in the iterator- Parameters:
iter- the iterator of values to be filteredfilter- the predicate used to filter the iterator- Returns:
- a new list containing only the elements that match the filter predicate
- See Also:
-
filter
public static <T,C extends Collection<T>> C filter(Iterator<? extends T> iter, Predicate<? super T> filter, IntFunction<C> supplier) Returns a new collection containing only the elements that match the filter predicate. An empty collection is returned if the input iterator is empty. The collection is created by the provided supplier function.- Type Parameters:
T- the type of the elements in the iterator- Parameters:
iter- the iterator of values to be filteredfilter- the predicate used to filter the iteratorsupplier- the supplier function that provides a new collection to store the filtered elements- Returns:
- a new collection containing only the elements that match the filter predicate
- See Also:
-
mapToBoolean
Transforms the elements of the specified array to boolean values using the specifiedToBooleanFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedmapper- the function used to map the elements to boolean values- Returns:
- a new boolean array containing the mapped values, or an empty boolean array if the input array is
nullor empty - See Also:
-
mapToBoolean
public static <T> boolean[] mapToBoolean(T[] a, int fromIndex, int toIndex, ToBooleanFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input array to boolean values using the specifiedToBooleanFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedfromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to boolean values- Returns:
- a new boolean array containing the mapped values, or an empty boolean array if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the array's bounds.- See Also:
-
mapToBoolean
public static <T> boolean[] mapToBoolean(Collection<? extends T> c, ToBooleanFunction<? super T> mapper) Transforms the elements of the specified collection to boolean values using the specifiedToBooleanFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
mapper- the function used to map the elements to boolean valuesa- the collection of values to be mapped- Returns:
- a new boolean array containing the mapped values, or an empty boolean collection if the input array is
nullor empty - See Also:
-
mapToBoolean
public static <T> boolean[] mapToBoolean(Collection<? extends T> c, int fromIndex, int toIndex, ToBooleanFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input collection to boolean values using the specifiedToBooleanFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to boolean valuesa- the collection of values to be mapped- Returns:
- a new boolean array containing the mapped values, or an empty boolean array if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the collection's bounds.- See Also:
-
mapToChar
Transforms the elements of the specified array to char values using the specifiedToCharFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedmapper- the function used to map the elements to char values- Returns:
- a new char array containing the mapped values, or an empty char array if the input array is
nullor empty - See Also:
-
mapToChar
public static <T> char[] mapToChar(T[] a, int fromIndex, int toIndex, ToCharFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input array to char values using the specifiedToCharFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedfromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to char values- Returns:
- a new char array containing the mapped values, or an empty char array if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the array's bounds.- See Also:
-
mapToChar
Transforms the elements of the specified collection to char values using the specifiedToCharFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
mapper- the function used to map the elements to char valuesa- the collection of values to be mapped- Returns:
- a new char array containing the mapped values, or an empty char collection if the input array is
nullor empty - See Also:
-
mapToChar
public static <T> char[] mapToChar(Collection<? extends T> c, int fromIndex, int toIndex, ToCharFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input collection to char values using the specifiedToCharFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to char valuesa- the collection of values to be mapped- Returns:
- a new char array containing the mapped values, or an empty char array if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the collection's bounds.- See Also:
-
mapToByte
Transforms the elements of the specified array to byte values using the specifiedToByteFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedmapper- the function used to map the elements to byte values- Returns:
- a new byte array containing the mapped values, or an empty byte array if the input array is
nullor empty - See Also:
-
mapToByte
public static <T> byte[] mapToByte(T[] a, int fromIndex, int toIndex, ToByteFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input array to byte values using the specifiedToByteFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedfromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to byte values- Returns:
- a new byte array containing the mapped values, or an empty byte array if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the array's bounds.- See Also:
-
mapToByte
Transforms the elements of the specified collection to byte values using the specifiedToByteFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
mapper- the function used to map the elements to byte valuesa- the collection of values to be mapped- Returns:
- a new byte array containing the mapped values, or an empty byte collection if the input array is
nullor empty - See Also:
-
mapToByte
public static <T> byte[] mapToByte(Collection<? extends T> c, int fromIndex, int toIndex, ToByteFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input collection to byte values using the specifiedToByteFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to byte valuesa- the collection of values to be mapped- Returns:
- a new byte array containing the mapped values, or an empty byte array if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the collection's bounds.- See Also:
-
mapToShort
Transforms the elements of the specified array to short values using the specifiedToShortFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedmapper- the function used to map the elements to short values- Returns:
- a new short array containing the mapped values, or an empty short array if the input array is
nullor empty - See Also:
-
mapToShort
public static <T> short[] mapToShort(T[] a, int fromIndex, int toIndex, ToShortFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input array to short values using the specifiedToShortFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedfromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to short values- Returns:
- a new short array containing the mapped values, or an empty short array if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the array's bounds.- See Also:
-
mapToShort
Transforms the elements of the specified collection to short values using the specifiedToShortFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
mapper- the function used to map the elements to short valuesa- the collection of values to be mapped- Returns:
- a new short array containing the mapped values, or an empty short collection if the input array is
nullor empty - See Also:
-
mapToShort
public static <T> short[] mapToShort(Collection<? extends T> c, int fromIndex, int toIndex, ToShortFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input collection to short values using the specifiedToShortFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to short valuesa- the collection of values to be mapped- Returns:
- a new short array containing the mapped values, or an empty short array if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the collection's bounds.- See Also:
-
mapToInt
Transforms the elements of the specified array to int values using the specifiedToIntFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedmapper- the function used to map the elements to int values- Returns:
- a new int array containing the mapped values, or an empty int array if the input array is
nullor empty
-
mapToInt
public static <T> int[] mapToInt(T[] a, int fromIndex, int toIndex, ToIntFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input array to int values using the specifiedToIntFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedfromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to int values- Returns:
- a new int array containing the mapped values, or an empty int array if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the array's bounds.- See Also:
-
mapToInt
Transforms the elements of the specified collection to int values using the specifiedToIntFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
mapper- the function used to map the elements to int valuesa- the collection of values to be mapped- Returns:
- a new int array containing the mapped values, or an empty int collection if the input array is
nullor empty - See Also:
-
mapToInt
public static <T> int[] mapToInt(Collection<? extends T> c, int fromIndex, int toIndex, ToIntFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input collection to int values using the specifiedToIntFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to int valuesa- the collection of values to be mapped- Returns:
- a new int array containing the mapped values, or an empty int array if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the collection's bounds.- See Also:
-
mapToInt
Transforms the long values in the specified array to int values using the specifiedLongToIntFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Parameters:
a- the array of long values to be mappedmapper- the function used to map the long values to int values- Returns:
- a new int array containing the mapped values, or an empty int array if the input array is
nullor empty
-
mapToInt
Transforms the double values in the specified array to int values using the specifiedDoubleToIntFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Parameters:
a- the array of double values to be mappedmapper- the function used to map the double values to int values- Returns:
- a new int array containing the mapped values, or an empty int array if the input array is
nullor empty
-
mapToLong
Transforms the elements of the specified array to long values using the specifiedToLongFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedmapper- the function used to map the elements to long values- Returns:
- a new long array containing the mapped values, or an empty long array if the input array is
nullor empty
-
mapToLong
public static <T> long[] mapToLong(T[] a, int fromIndex, int toIndex, ToLongFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input array to long values using the specifiedToLongFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedfromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to long values- Returns:
- a new long array containing the mapped values, or an empty long array if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the array's bounds.- See Also:
-
mapToLong
Transforms the elements of the specified collection to long values using the specifiedToLongFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
mapper- the function used to map the elements to long valuesa- the collection of values to be mapped- Returns:
- a new long array containing the mapped values, or an empty long collection if the input array is
nullor empty - See Also:
-
mapToLong
public static <T> long[] mapToLong(Collection<? extends T> c, int fromIndex, int toIndex, ToLongFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input collection to long values using the specifiedToLongFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to long valuesa- the collection of values to be mapped- Returns:
- a new long array containing the mapped values, or an empty long array if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the collection's bounds.- See Also:
-
mapToLong
Transforms the int values in the specified array to long values using the specifiedIntToLongFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Parameters:
a- the array of int values to be mappedmapper- the function used to map the int values to long values- Returns:
- a new long array containing the mapped values, or an empty long array if the input array is
nullor empty
-
mapToLong
Transforms the double values in the specified array to long values using the specifiedDoubleToLongFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Parameters:
a- the array of double values to be mappedmapper- the function used to map the double values to long values- Returns:
- a new long array containing the mapped values, or an empty long array if the input array is
nullor empty
-
mapToFloat
Transforms the elements of the specified array to float values using the specifiedToFloatFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedmapper- the function used to map the elements to float values- Returns:
- a new float array containing the mapped values, or an empty float array if the input array is
nullor empty
-
mapToFloat
public static <T> float[] mapToFloat(T[] a, int fromIndex, int toIndex, ToFloatFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input array to float values using the specifiedToFloatFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedfromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to float values- Returns:
- a new float array containing the mapped values, or an empty float array if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the array's bounds.- See Also:
-
mapToFloat
Transforms the elements of the specified collection to float values using the specifiedToFloatFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
mapper- the function used to map the elements to float valuesa- the collection of values to be mapped- Returns:
- a new float array containing the mapped values, or an empty float collection if the input array is
nullor empty - See Also:
-
mapToFloat
public static <T> float[] mapToFloat(Collection<? extends T> c, int fromIndex, int toIndex, ToFloatFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input collection to float values using the specifiedToFloatFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to float valuesa- the collection of values to be mapped- Returns:
- a new float array containing the mapped values, or an empty float array if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the collection's bounds.- See Also:
-
mapToDouble
Transforms the elements of the specified array to double values using the specifiedToDoubleFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedmapper- the function used to map the elements to double values- Returns:
- a new double array containing the mapped values, or an empty double array if the input array is
nullor empty
-
mapToDouble
public static <T> double[] mapToDouble(T[] a, int fromIndex, int toIndex, ToDoubleFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input array to double values using the specifiedToDoubleFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array of values to be mappedfromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to double values- Returns:
- a new double array containing the mapped values, or an empty double array if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the array's bounds.- See Also:
-
mapToDouble
public static <T> double[] mapToDouble(Collection<? extends T> c, ToDoubleFunction<? super T> mapper) Transforms the elements of the specified collection to double values using the specifiedToDoubleFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
mapper- the function used to map the elements to double valuesa- the collection of values to be mapped- Returns:
- a new double array containing the mapped values, or an empty double collection if the input array is
nullor empty - See Also:
-
mapToDouble
public static <T> double[] mapToDouble(Collection<? extends T> c, int fromIndex, int toIndex, ToDoubleFunction<? super T> mapper) throws IndexOutOfBoundsException Transforms the elements within the specified range in the input collection to double values using the specifiedToDoubleFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the collection- Parameters:
fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- the function used to map the elements to double valuesa- the collection of values to be mapped- Returns:
- a new double array containing the mapped values, or an empty double array if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- the specified range is out of the collection's bounds.- See Also:
-
mapToDouble
Transforms the int values in the specified array to double values using the specifiedIntToDoubleFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Parameters:
a- the array of int values to be mappedmapper- the function used to map the int values to double values- Returns:
- a new double array containing the mapped values, or an empty double array if the input array is
nullor empty
-
mapToDouble
Transforms the long values in the specified array to double values using the specifiedIntToDoubleFunction.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Parameters:
a- the array of long values to be mappedmapper- the function used to map the long values to double values- Returns:
- a new double array containing the mapped values, or an empty double array if the input array is
nullor empty
-
map
Transforms the elements in the specified array from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input array.R- The type of the elements are mapped to.- Parameters:
a- The input array to be transformed.mapper- The function to apply to each element in the input array.- Returns:
- A list containing the transformed elements, or an empty list if the input array is
nullor empty.
-
map
public static <T,R, C mapC extends Collection<R>> (T[] a, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified array from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input array.R- The type of the elements are mapped to.- Parameters:
a- The input array to be transformed.mapper- The function to apply to each element in the input array.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input array/range isnullor empty.
-
map
public static <T,R> List<R> map(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper) throws IndexOutOfBoundsExceptionTransforms the elements within the specified range in the input array from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input array.R- The type of the elements are mapped to.- Parameters:
a- The input array to be transformed.fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- The function to apply to each element in the input array.- Returns:
- A list containing the transformed elements, or an empty list if the input array is
nullor empty. - Throws:
IndexOutOfBoundsException- If the specified range is out of the array's bounds.
-
map
public static <T,R, C mapC extends Collection<R>> (T[] a, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionTransforms the elements within the specified range in the input array from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input array.R- The type of the elements are mapped to.- Parameters:
a- The input array to be transformed.fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- The function to apply to each element in the input array.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input array/range isnullor empty. - Throws:
IndexOutOfBoundsException- If the specified range is out of the array's bounds.
-
map
public static <T,R> List<R> map(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper) throws IndexOutOfBoundsExceptionTransforms the elements within the specified range in the input collection from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input collection.R- The type of the elements are mapped to.- Parameters:
c- The input collection to be transformed.fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- The function to apply to each element in the input collection.- Returns:
- A list containing the transformed elements, or an empty list if the input collection is
nullor empty. - Throws:
IndexOutOfBoundsException- If the specified range is out of the collection's bounds.
-
map
public static <T,R, C mapC extends Collection<R>> (Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionTransforms the elements within the specified range in the input collection from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input collection.R- The type of the elements are mapped to.C- The type of the returned collection- Parameters:
c- The input collection to be transformed.fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- The function to apply to each element in the input collection.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input collection/range isnullor empty. - Throws:
IndexOutOfBoundsException- If the specified range is out of the collection's bounds.
-
map
Transforms the elements in the specified iterable from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the iterable.R- The type of the elements are mapped to.- Parameters:
c- The input iterable to be transformed.mapper- The function to apply to each element in the input iterable.- Returns:
- A list containing the transformed elements, or an empty list if the input iterable is
nullor empty.
-
map
public static <T,R, C mapC extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified iterable from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the iterable.R- The type of the elements are mapped to.C- The type of the returned collection- Parameters:
c- The input iterable to be transformed.mapper- The function to apply to each element in the input iterable.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input iterable isnullor empty.
-
map
public static <T,R> List<R> map(Iterator<? extends T> iter, Function<? super T, ? extends R> mapper) Transforms the elements in the specified iterator from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the iterator.R- The type of the elements are mapped to.- Parameters:
iter- The input iterator to be transformed.mapper- The function to apply to each element in the input iterator.- Returns:
- A list containing the transformed elements, or an empty list if the input iterator is
nullor empty. - See Also:
-
map
public static <T,R, C mapC extends Collection<R>> (Iterator<? extends T> iter, Function<? super T, ? extends R> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified iterator from type: {code T} to type:Rby applying the specifiedFunction<T, R>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the iterator.R- The type of the elements are mapped to.C- The type of the returned collection- Parameters:
iter- The input iterable to be transformed.mapper- The function to apply to each element in the input iterator.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input iterator isnullor empty. - See Also:
-
flatMap
public static <T,R> List<R> flatMap(T[] a, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements in the specified array from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input array.R- The type of the elements are mapped to.- Parameters:
a- The input array to be transformed.mapper- The function to transform each element in the input array to a collection.- Returns:
- A list containing the transformed elements, or an empty list if the input array is
nullor empty.
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (T[] a, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) Transforms the elements in the specified array from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input array.R- The type of the elements are mapped to.- Parameters:
a- The input array to be transformed.mapper- The function to transform each element in the input array to a collection.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input array/range isnullor empty.
-
flatMap
public static <T,R> List<R> flatMap(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements within the specified range in the input array from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input array.R- The type of the elements are mapped to.- Parameters:
a- The input array to be transformed.fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- The function to transform each element in the input array to a collection.- Returns:
- A list containing the transformed elements, or an empty list if the input array is
nullor empty. - Throws:
IndexOutOfBoundsException- If the specified range is out of the array's bounds.
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (T[] a, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionTransforms the elements within the specified range in the input array from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input array.R- The type of the elements are mapped to.C- The type of the returned collection- Parameters:
a- The input array to be transformed.fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- The function to transform each element in the input array to a collection.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input array/range isnullor empty. - Throws:
IndexOutOfBoundsException- If the specified range is out of the array's bounds.
-
flatMap
public static <T,R> List<R> flatMap(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper) throws IndexOutOfBoundsExceptionTransforms the elements within the specified range in the input collection from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input collection.R- The type of the elements are mapped to.- Parameters:
c- The input collection to be transformed.fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- The function to transform each element in the input collection to a collection.- Returns:
- A list containing the transformed elements, or an empty list if the input collection is
nullor empty. - Throws:
IndexOutOfBoundsException- If the specified range is out of the collection's bounds.
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionTransforms the elements within the specified range in the input collection from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the input collection.R- The type of the elements are mapped to.C- The type of the returned collection- Parameters:
c- The input collection to be transformed.fromIndex- the starting index (inclusive) of the range to be mappedtoIndex- the ending index (exclusive) of the range to be mappedmapper- The function to transform each element in the input collection to a collection.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input collection/range isnullor empty. - Throws:
IndexOutOfBoundsException- If the specified range is out of the collection's bounds.
-
flatMap
public static <T,R> List<R> flatMap(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements in the specified iterable from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the iterable.R- The type of the elements are mapped to.- Parameters:
c- The input iterable to be transformed.mapper- The function to transform each element in the input iterable to a collection.- Returns:
- A list containing the transformed elements, or an empty list if the input iterable is
nullor empty.
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionTransforms the elements in the specified iterable from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the iterable.R- The type of the elements are mapped to.C- The type of the returned collection- Parameters:
c- The input iterable to be transformed.mapper- The function to transform each element in the input iterable to a collection.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input iterable isnullor empty. - Throws:
IndexOutOfBoundsException
-
flatMap
public static <T,R> List<R> flatMap(Iterator<? extends T> iter, Function<? super T, ? extends Collection<? extends R>> mapper) Transforms the elements in the specified iterator from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the iterator.R- The type of the elements are mapped to.- Parameters:
iter- The input iterator to be transformed.mapper- The function to transform each element in the input iterator to a collection.- Returns:
- A list containing the transformed elements, or an empty list if the input iterator is
nullor empty. - See Also:
-
flatMap
public static <T,R, C flatMapC extends Collection<R>> (Iterator<? extends T> iter, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<? extends C> supplier) throws IndexOutOfBoundsExceptionTransforms the elements in the specified iterator from type: {code T} to a collection of type:Rby applying the specifiedFunction<T, Collection<R>>to each element.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- The type of the elements in the iterator.R- The type of the elements are mapped to.C- The type of the returned collection- Parameters:
iter- The input iterator to be transformed.mapper- The function to transform each element in the input iterator to a collection.supplier- The supplier used to create the returned collection.- Returns:
- A collection containing the transformed elements, or an empty collection created by the
supplierif the input iterator isnullor empty. - Throws:
IndexOutOfBoundsException- See Also:
-
flatMap
public static <T,U, List<R> flatMapR> (T[] a, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) Transforms the elements in the specified array from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the input arrayU- the intermediate type of the elements after the first mappingR- the type of the elements in the resulting list- Parameters:
a- the input array to be transformedmapper- the function to transform each element in the input array to a collection of typeUmapper2- the function to transform each element in the intermediate collections to a collection of typeR- Returns:
- a list containing the transformed elements, or an empty list if the input array is
nullor empty
-
flatMap
public static <T,U, C flatMapR, C extends Collection<R>> (T[] a, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Transforms the elements in the specified array from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the input arrayU- the intermediate type of the elements after the first mappingR- the type of the elements in the resulting listC- the type of the returned collection- Parameters:
a- the input array to be transformedmapper- the function to transform each element in the input array to a collection of typeUmapper2- the function to transform each element in the intermediate collections to a collection of typeRsupplier- the supplier used to create the returned collection- Returns:
- a collection containing the transformed elements, or an empty collection created by the
supplierif the input array isnullor empty
-
flatMap
public static <T,U, List<R> flatMapR> (Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) Transforms the elements in the specified iterable from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the input iterableU- the intermediate type of the elements after the first mappingR- the type of the elements in the resulting list- Parameters:
c- the input iterable to be transformedmapper- the function to transform each element in the input iterable to a collection of typeUmapper2- the function to transform each element in the intermediate collections to a collection of typeR- Returns:
- a list containing the transformed elements, or an empty list if the input iterable is
nullor empty
-
flatMap
public static <T,U, C flatMapR, C extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Transforms the elements in the specified iterable from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the input iterableU- the intermediate type of the elements after the first mappingR- the type of the elements in the resulting listC- the type of the returned collection- Parameters:
c- the input iterable to be transformedmapper- the function to transform each element in the input iterable to a collection of typeUmapper2- the function to transform each element in the intermediate collections to a collection of typeRsupplier- the supplier used to create the returned collection- Returns:
- a collection containing the transformed elements, or an empty collection created by the
supplierif the input iterable isnullor empty
-
flatMap
public static <T,U, List<R> flatMapR> (Iterator<? extends T> iter, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2) Transforms the elements in the specified iterator from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the input iteratorU- the intermediate type of the elements after the first mappingR- the type of the elements in the resulting list- Parameters:
iter- the input iterator to be transformedmapper- the function to transform each element in the input iterator to a collection of typeUmapper2- the function to transform each element in the intermediate collections to a collection of typeR- Returns:
- a list containing the transformed elements, or an empty list if the input iterator is
nullor empty
-
flatMap
public static <T,U, C flatMapR, C extends Collection<R>> (Iterator<? extends T> iter, Function<? super T, ? extends Collection<? extends U>> mapper, Function<? super U, ? extends Collection<? extends R>> mapper2, IntFunction<? extends C> supplier) Transforms the elements in the specified iterator from typeTto a collection of typeRby applying the specifiedFunction<T, Collection<U>>to each element, and then applying the specifiedFunction<U, Collection<R>>to each element in the intermediate collections.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of the elements in the input iteratorU- the intermediate type of the elements after the first mappingR- the type of the elements in the resulting listC- the type of the returned collection- Parameters:
iter- the input iterator to be transformedmapper- the function to transform each element in the input iterator to a collection of typeUmapper2- the function to transform each element in the intermediate collections to a collection of typeRsupplier- the supplier used to create the returned collection- Returns:
- a collection containing the transformed elements, or an empty collection created by the
supplierif the input iterator isnullor empty.
-
takeWhile
Returns a list containing the elements of the input array until the provided predicate returnsfalse.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array to be processedfilter- the predicate used to test elements- Returns:
- a list of elements from the input array starting from the first element until the predicate returns
false. An empty list is returned if the input array isnullor empty.
-
takeWhile
Returns a list containing the elements of the input iterable until the provided predicate returnsfalse.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the iterable to be processedfilter- the predicate used to test elements- Returns:
- a list of elements from the input iterable starting from the first element until the predicate returns
false. An empty list is returned if the input iterable isnullor empty.
-
takeWhile
Returns a list containing the elements of the input iterator until the provided predicate returnsfalse.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the iterator to be processedfilter- the predicate used to test elements- Returns:
- a list of elements from the input iterator starting from the first element until the predicate returns
false. An empty list is returned if the input iterator isnullor empty.
-
takeWhileInclusive
Returns a list containing the elements of the input array until the provided predicate returnsfalse, including the element that fails the predicate.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array to process.filter- the predicate to apply to elements of the array.- Returns:
- a list of elements from the input array starting from the first element until the predicate returns
false, including the element that fails the predicate. An empty list is returned if the input array isnullor empty.
-
takeWhileInclusive
Returns a list containing the elements of the input iterable until the provided predicate returnsfalse, including the element that fails the predicate.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the iterable to process.filter- the predicate to apply to elements of the iterable.- Returns:
- a list of elements from the input iterable starting from the first element until the predicate returns
false, including the element that fails the predicate. An empty list is returned if the input iterable isnullor empty.
-
takeWhileInclusive
public static <T> List<T> takeWhileInclusive(Iterator<? extends T> iter, Predicate<? super T> filter) Returns a list containing the elements of the input iterator until the provided predicate returnsfalse, including the element that fails the predicate.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the iterator to process.filter- the predicate to apply to elements of the iterator.- Returns:
- a list of elements from the input iterator starting from the first element until the predicate returns
false, including the element that fails the predicate. An empty list is returned if the input iterator isnullor empty.
-
dropWhile
Returns a list containing the elements of the input array after dropping the elements that satisfy the provided predicate.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array to process.filter- the predicate to apply to elements of the array.- Returns:
- a list of elements from the input array starting from the first element that fails the predicate. An empty list is returned if the input array is
nullor empty.
-
dropWhile
Returns a list containing the elements of the input iterable after dropping the elements that satisfy the provided predicate.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the iterable to process.filter- the predicate to apply to elements of the iterable.- Returns:
- a list of elements from the input iterable starting from the first element that fails the predicate. An empty list is returned if the input iterable is
nullor empty.
-
dropWhile
Returns a list containing the elements of the input iterator after dropping the elements that satisfy the provided predicate.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the iterator to process.filter- the predicate to apply to elements of the iterator.- Returns:
- a list of elements from the input iterator starting from the first element that fails the predicate. An empty list is returned if the input iterator is
nullor empty.
-
skipUntil
Returns a list containing the elements of the input array starting from the first element that satisfies the provided predicate.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the array to process.filter- the predicate to apply to elements of the array.- Returns:
- a list of elements from the input array starting from the first element that satisfies the predicate. An empty list if the input array is
nullor empty.
-
skipUntil
Returns a list containing the elements of the input iterable starting from the first element that satisfies the provided predicate.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the iterable to process.filter- the predicate to apply to elements of the iterable.- Returns:
- a list of elements from the input iterable starting from the first element that satisfies the predicate. An empty list is returned if the input iterable is
nullor empty.
-
skipUntil
Returns a list containing the elements of the input iterator starting from the first element that satisfies the provided predicate.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
iter- the iterator to process.filter- the predicate to apply to elements of the iterator.- Returns:
- a list of elements from the input iterator starting from the first element that satisfies the predicate. An empty list is returned if the input iterator is
nullor empty.
-
mapAndFilter
@Beta public static <T,R> List<R> mapAndFilter(Iterable<? extends T> c, Function<? super T, ? extends R> mapper, Predicate<? super R> filter) Maps and filters the elements in the given iterable.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of elements in the input iterableR- the type of elements in the resulting list- Parameters:
c- the input iterablemapper- the function to apply to each elementfilter- the predicate to apply to each mapped element- Returns:
- a list of elements that have been mapped and filtered. An empty list is returned if the input iterable is
nullor empty. - See Also:
-
mapAndFilter
@Beta public static <T,R, C mapAndFilterC extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends R> mapper, Predicate<? super R> filter, IntFunction<? extends C> supplier) Maps and filters the elements in the given iterable.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of elements in the input iterableR- the type of elements in the resulting collectionC- the type of the resulting collection- Parameters:
c- the input iterablemapper- the function to apply to each elementfilter- the predicate to apply to each mapped elementsupplier- the supplier used to create the returned collection- Returns:
- a collection of elements that have been mapped and filtered. An empty collection created by the specified
supplieris returned if the input iterable isnullor empty. - See Also:
-
filterAndMap
@Beta public static <T,R> List<R> filterAndMap(Iterable<? extends T> c, Predicate<? super T> filter, Function<? super T, ? extends R> mapper) Filters and maps the elements in the given iterable.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of elements in the input iterableR- the type of elements in the resulting list- Parameters:
c- the input iterablefilter- the predicate to apply to each elementmapper- the function to apply to each filtered element- Returns:
- a list of elements that have been filtered and mapped. An empty list is returned if the input iterable is
nullor empty. - See Also:
-
filterAndMap
@Beta public static <T,R, C filterAndMapC extends Collection<R>> (Iterable<? extends T> c, Predicate<? super T> filter, Function<? super T, ? extends R> mapper, IntFunction<C> supplier) Filters and maps the elements in the given iterable.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of elements in the input iterableR- the type of elements in the resulting collectionC- the type of the resulting collection- Parameters:
c- the input iterablefilter- the predicate to apply to each elementmapper- the function to apply to each filtered elementsupplier- the supplier used to create the returned collection- Returns:
- a collection of elements that have been filtered and mapped. An empty collection created by the specified
supplieris returned if the input iterable isnullor empty. - See Also:
-
flatMapAndFilter
@Beta public static <T,R> List<R> flatMapAndFilter(Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper, Predicate<? super R> filter) Flat-maps and filters the elements in the given iterable.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of elements in the input iterableR- the type of elements in the resulting collection- Parameters:
c- the input iterablemapper- the function to apply to each element, which returns a collection of resultsfilter- the predicate to apply to each element of the resulting collections- Returns:
- a list of elements that have been flat-mapped and filtered. An empty list is returned if the input iterable is
nullor empty. - See Also:
-
flatMapAndFilter
@Beta public static <T,R, C flatMapAndFilterC extends Collection<R>> (Iterable<? extends T> c, Function<? super T, ? extends Collection<? extends R>> mapper, Predicate<? super R> filter, IntFunction<? extends C> supplier) Flat-maps and filters the elements in the given iterable.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of elements in the input iterableR- the type of elements in the resulting collectionC- the type of the resulting collection- Parameters:
c- the input iterablemapper- the function to apply to each element, which returns a collection of resultsfilter- the predicate to apply to each element of the resulting collectionssupplier- the supplier used to create the returned collection- Returns:
- a collection of elements that have been flat-mapped and filtered. An empty collection created by the specified
supplieris returned if the input iterable isnullor empty. - See Also:
-
filterAndFlatMap
@Beta public static <T,R> List<R> filterAndFlatMap(Iterable<? extends T> c, Predicate<? super T> filter, Function<? super T, ? extends Collection<? extends R>> mapper) Filters and flat-maps the elements in the given iterable.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of elements in the input iterableR- the type of elements in the resulting list- Parameters:
c- the input iterablefilter- the predicate to apply to each element to determine if it should be includedmapper- the function to apply to each filtered element, which returns a collection of results- Returns:
- a list of elements that have been filtered and flat-mapped. An empty list is returned if the input iterable is
nullor empty. - See Also:
-
filterAndFlatMap
@Beta public static <T,R, C filterAndFlatMapC extends Collection<R>> (Iterable<? extends T> c, Predicate<? super T> filter, Function<? super T, ? extends Collection<? extends R>> mapper, IntFunction<C> supplier) Filters and flat-maps the elements in the given iterable.
The returned collection is created by the specifiedsupplier.Mostly it's designed for one-step operation.
java.util.stream.Streamis preferred for multiple phases operation.- Type Parameters:
T- the type of elements in the input iterableR- the type of elements in the resulting collectionC- the type of the resulting collection- Parameters:
c- the input iterablefilter- the predicate to apply to each element to determine if it should be includedmapper- the function to apply to each filtered element, which returns a collection of resultssupplier- the supplier used to create the returned collection- Returns:
- a collection of elements that have been filtered and flat-mapped. An empty collection created by the specified
supplieris returned if the input iterable isnullor empty. - See Also:
-
distinct
public static boolean[] distinct(boolean[] a) Returns a new array containing only the distinct elements from the specified array.- Parameters:
a- the input array of boolean values- Returns:
- a new array containing only the distinct elements from the specified array. An empty array is returned if the specified array is
nullor empty.
-
distinct
public static boolean[] distinct(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array containing only the distinct elements from the specified range in the input array.- Parameters:
a- the input array of boolean valuesfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new array containing only the distinct elements from the specified range in the input array. An empty array is returned if the specified array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinct
public static char[] distinct(char[] a) Returns a new array containing only the distinct elements from the specified array.- Parameters:
a- the input array of char values- Returns:
- a new array containing only the distinct elements from the specified array. An empty array is returned if the specified array is
nullor empty.
-
distinct
public static char[] distinct(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array containing only the distinct elements from the specified range in the input array.- Parameters:
a- the input array of char valuesfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new array containing only the distinct elements from the specified range in the input array. An empty array is returned if the specified array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinct
public static byte[] distinct(byte[] a) Returns a new array containing only the distinct elements from the specified array.- Parameters:
a- the input array of byte values- Returns:
- a new array containing only the distinct elements from the specified array. An empty array is returned if the specified array is
nullor empty.
-
distinct
public static byte[] distinct(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array containing only the distinct elements from the specified range in the input array.- Parameters:
a- the input array of byte valuesfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new array containing only the distinct elements from the specified range in the input array. An empty array is returned if the specified array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinct
public static short[] distinct(short[] a) Returns a new array containing only the distinct elements from the specified array.- Parameters:
a- the input array of short values- Returns:
- a new array containing only the distinct elements from the specified array. An empty array is returned if the specified array is
nullor empty.
-
distinct
public static short[] distinct(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array containing only the distinct elements from the specified range in the input array.- Parameters:
a- the input array of short valuesfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new array containing only the distinct elements from the specified range in the input array. An empty array is returned if the specified array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinct
public static int[] distinct(int[] a) Returns a new array containing only the distinct elements from the specified array.- Parameters:
a- the input array of int values- Returns:
- a new array containing only the distinct elements from the specified array. An empty array is returned if the specified array is
nullor empty.
-
distinct
Returns a new array containing only the distinct elements from the specified range in the input array.- Parameters:
a- the input array of int valuesfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new array containing only the distinct elements from the specified range in the input array. An empty array is returned if the specified array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinct
public static long[] distinct(long[] a) Returns a new array containing only the distinct elements from the specified array.- Parameters:
a- the input array of long values- Returns:
- a new array containing only the distinct elements from the specified array. An empty array is returned if the specified array is
nullor empty.
-
distinct
public static long[] distinct(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array containing only the distinct elements from the specified range in the input array.- Parameters:
a- the input array of long valuesfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new array containing only the distinct elements from the specified range in the input array. An empty array is returned if the specified array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinct
public static float[] distinct(float[] a) Returns a new array containing only the distinct elements from the specified array.- Parameters:
a- the input array of float values- Returns:
- a new array containing only the distinct elements from the specified array. An empty array is returned if the specified array is
nullor empty.
-
distinct
public static float[] distinct(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array containing only the distinct elements from the specified range in the input array.- Parameters:
a- the input array of float valuesfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new array containing only the distinct elements from the specified range in the input array. An empty array is returned if the specified array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinct
public static double[] distinct(double[] a) Returns a new array containing only the distinct elements from the specified array.- Parameters:
a- the input array of double values- Returns:
- a new array containing only the distinct elements from the specified array. An empty array is returned if the specified array is
nullor empty.
-
distinct
public static double[] distinct(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new array containing only the distinct elements from the specified range in the input array.- Parameters:
a- the input array of double valuesfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new array containing only the distinct elements from the specified range in the input array. An empty array is returned if the specified array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinct
Returns a new list containing only the distinct elements from the specified array.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input array- Returns:
- a new list containing only the distinct elements from the specified array. An empty list is returned if the input array is
nullor empty. - See Also:
-
distinct
public static <T> List<T> distinct(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new list containing only the distinct elements from the specified range in the input array.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new list containing only the distinct elements from the specified range in the input array. An empty list is returned if the input array/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
distinct
public static <T> List<T> distinct(Collection<? extends T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new list containing only the distinct elements from the specified range in the input collection.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the input collectionfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the range- Returns:
- a new list containing only the distinct elements from the specified range in the input collection. An empty list is returned if the input collection/range is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
distinct
Returns a new list containing only the distinct elements from the specified iterable.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the input iterable- Returns:
- a new list containing only the distinct elements from the specified iterable. An empty list is returned if the input iterable is
nullor empty - See Also:
-
distinct
Returns a new list containing only the distinct elements from the specified iterator.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the input iterator- Returns:
- a new list containing only the distinct elements from the specified iterator. An empty list is returned if the input iterator is
nullor empty - See Also:
-
distinctBy
Returns a new list containing only the distinct elements from the specified array, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arraykeyExtractor- the function to extract the key for distinct comparison- Returns:
- a new list containing only the distinct elements from the input array. An empty list is returned if the input array is
nullor empty
-
distinctBy
public static <T> List<T> distinctBy(T[] a, int fromIndex, int toIndex, Function<? super T, ?> keyExtractor) throws IndexOutOfBoundsExceptionReturns a new list containing only the distinct elements from the specified range in the input array, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangekeyExtractor- the function to extract the key for distinct comparison- Returns:
- a new list containing only the distinct elements from the specified range in the input array. An empty list is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinctBy
public static <T,C extends Collection<T>> C distinctBy(T[] a, Function<? super T, ?> keyExtractor, Supplier<C> supplier) Returns a new collection containing only the distinct elements from the specified array, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>. The returned collection is created by the specifiedsupplier.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arraykeyExtractor- the function to extract the key for distinct comparisonsupplier- the supplier used to create the returned collection- Returns:
- a new collection containing only the distinct elements from the input array. An empty collection is returned if the input array is
nullor empty
-
distinctBy
public static <T> List<T> distinctBy(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ?> keyExtractor) throws IndexOutOfBoundsExceptionReturns a new list containing only the distinct elements from the specified range in the input collection, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the input collectionfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangekeyExtractor- the function to extract the key for distinct comparison- Returns:
- a new list containing only the distinct elements from the specified range in the input collection. An empty list is returned if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
distinctBy
Returns a new list containing only the distinct elements from the specified iterable, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the input iterablekeyExtractor- the function to extract the key for distinct comparison- Returns:
- a new list containing only the distinct elements from the specified iterable. An empty list is returned if the input iterable is
nullor empty
-
distinctBy
public static <T,C extends Collection<T>> C distinctBy(Iterable<? extends T> c, Function<? super T, ?> keyExtractor, Supplier<C> supplier) Returns a new collection containing only the distinct elements from the specified iterable, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>. The returned collection is created by the specifiedsupplier.- Type Parameters:
T- the type of elements in the input iterableC- the type of the resulting collection- Parameters:
c- the input iterablekeyExtractor- the function to extract the key for distinct comparisonsupplier- the supplier used to create the returned collection- Returns:
- a new collection containing only the distinct elements from the input iterable. An empty collection is returned if the input iterable is
nullor empty
-
distinctBy
public static <T> List<T> distinctBy(Iterator<? extends T> iter, Function<? super T, ?> keyExtractor) Returns a new list containing only the distinct elements from the specified iterator, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the input iteratorkeyExtractor- the function to extract the key for distinct comparison- Returns:
- a new list containing only the distinct elements from the specified iterator. An empty list is returned if the input iterator is
nullor empty - See Also:
-
distinctBy
public static <T,C extends Collection<T>> C distinctBy(Iterator<? extends T> iter, Function<? super T, ?> keyExtractor, Supplier<C> supplier) Returns a new collection containing only the distinct elements from the specified iterator, where distinctness is determined by the keys extracted by the specifiedFunction<T, K>. The returned collection is created by the specifiedsupplier.- Type Parameters:
T- the type of elements in the input iteratorC- the type of the resulting collection- Parameters:
iter- the input iteratorkeyExtractor- the function to extract the key for distinct comparisonsupplier- the supplier used to create the returned collection- Returns:
- a new collection containing only the distinct elements from the input iterator. An empty collection is returned if the input iterator is
nullor empty
-
allMatch
Checks if all elements in the input array match the given predicate.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arrayfilter- the predicate to apply to each element- Returns:
trueif all elements match the predicate or the input array isnullor empty,falseotherwise
-
allMatch
Checks if all elements in the input iterable match the given predicate.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the input iterablefilter- the predicate to apply to each element- Returns:
trueif all elements match the predicate or the input iterable isnullor empty,falseotherwise
-
allMatch
Checks if all elements in the input iterator match the given predicate.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the input iteratorfilter- the predicate to apply to each element- Returns:
trueif all elements match the predicate or the input iterator isnullor empty,falseotherwise
-
anyMatch
Checks if any element in the input array matches the given predicate.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arrayfilter- the predicate to apply to each element- Returns:
trueif any element matches the predicate,falseotherwise
-
anyMatch
Checks if any element in the input iterable matches the given predicate.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the input iterablefilter- the predicate to apply to each element- Returns:
trueif any element matches the predicate,falseotherwise
-
anyMatch
Checks if any element in the input iterator matches the given predicate.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the input iteratorfilter- the predicate to apply to each element- Returns:
trueif any element matches the predicate,falseotherwise
-
noneMatch
Checks if none of the elements in the input array match the given predicate.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arrayfilter- the predicate to apply to each element- Returns:
trueif none of the elements match the predicate or the input array isnullor empty,falseotherwise
-
noneMatch
Checks if none of the elements in the input iterable match the given predicate.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the input iterablefilter- the predicate to apply to each element- Returns:
trueif none of the elements match the predicate or the input iterable isnullor empty,falseotherwise
-
noneMatch
Checks if none of the elements in the input iterator match the given predicate.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the input iteratorfilter- the predicate to apply to each element- Returns:
trueif none of the elements match the predicate or the input iterator isnullor empty,falseotherwise
-
nMatch
Checks if the number of elements in the input array that match the given predicate is between the specified minimum and maximum values (inclusive).- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arrayfilter- the predicate to apply to each element- Returns:
trueif the number of matching elements is betweenatLeastandatMost(inclusive),falseotherwise- Throws:
IllegalArgumentException- ifatLeastoratMostis negative, or ifatLeastis greater than atMost
-
nMatch
public static <T> boolean nMatch(Iterable<? extends T> c, int atLeast, int atMost, Predicate<? super T> filter) Checks if the number of elements in the input iterable that match the given predicate is between the specified minimum and maximum values (inclusive).- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the input iterablefilter- the predicate to apply to each element- Returns:
trueif the number of matching elements is betweenatLeastandatMost(inclusive),falseotherwise- Throws:
IllegalArgumentException- ifatLeastoratMostis negative, or ifatLeastis greater than atMost
-
nMatch
public static <T> boolean nMatch(Iterator<? extends T> iter, int atLeast, int atMost, Predicate<? super T> filter) Checks if the number of elements in the input iterator that match the given predicate is between the specified minimum and maximum values (inclusive).- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the input iteratorfilter- the predicate to apply to each element- Returns:
trueif the number of matching elements is betweenatLeastandatMost(inclusive),falseotherwise- Throws:
IllegalArgumentException- ifatLeastoratMostis negative, or ifatLeastis greater than atMost
-
allTrue
public static boolean allTrue(boolean[] a) Checks if all elements in the input boolean array aretrue.- Parameters:
a- the input boolean array- Returns:
trueif all elements aretrueor the input array isnullor empty,falseotherwise
-
allFalse
public static boolean allFalse(boolean[] a) Checks if all elements in the input boolean array arefalse.- Parameters:
a- the input boolean array- Returns:
trueif all elements arefalseor the input array isnullor empty,falseotherwise
-
anyTrue
public static boolean anyTrue(boolean[] a) Checks if any element in the input boolean array istrue.- Parameters:
a- the input boolean array- Returns:
trueif any element istrue,falseotherwise
-
anyFalse
public static boolean anyFalse(boolean[] a) Checks if any element in the input boolean array isfalse.- Parameters:
a- the input boolean array- Returns:
trueif any element isfalse,falseotherwise
-
count
Counts the number of elements in the input boolean array that match the given predicate.- Parameters:
a- the input boolean arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty
-
count
public static int count(boolean[] a, int fromIndex, int toIndex, BooleanPredicate filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input boolean array that match the given predicate.- Parameters:
a- the input boolean arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input boolean array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input byte array that match the given predicate.- Parameters:
a- the input byte arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty
-
count
public static int count(char[] a, int fromIndex, int toIndex, CharPredicate filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input byte array that match the given predicate.- Parameters:
a- the input byte arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input byte array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input byte array that match the given predicate.- Parameters:
a- the input byte arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty
-
count
public static int count(byte[] a, int fromIndex, int toIndex, BytePredicate filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input byte array that match the given predicate.- Parameters:
a- the input byte arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input byte array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input short array that match the given predicate.- Parameters:
a- the input short arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty
-
count
public static int count(short[] a, int fromIndex, int toIndex, ShortPredicate filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input short array that match the given predicate.- Parameters:
a- the input short arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input short array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input int array that match the given predicate.- Parameters:
a- the input int arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty
-
count
public static int count(int[] a, int fromIndex, int toIndex, IntPredicate filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input int array that match the given predicate.- Parameters:
a- the input int arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input int array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input long array that match the given predicate.- Parameters:
a- the input long arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty
-
count
public static int count(long[] a, int fromIndex, int toIndex, LongPredicate filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input long array that match the given predicate.- Parameters:
a- the input long arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input long array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input float array that match the given predicate.- Parameters:
a- the input float arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty
-
count
public static int count(float[] a, int fromIndex, int toIndex, FloatPredicate filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input float array that match the given predicate.- Parameters:
a- the input float arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input float array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input double array that match the given predicate.- Parameters:
a- the input double arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty - Throws:
IndexOutOfBoundsException
-
count
public static int count(double[] a, int fromIndex, int toIndex, DoublePredicate filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input double array that match the given predicate.- Parameters:
a- the input double arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input double array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input array that match the given predicate.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arrayfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input array is
nullor empty - Throws:
IndexOutOfBoundsException
-
count
public static <T> int count(T[] a, int fromIndex, int toIndex, Predicate<? super T> filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input array that match the given predicate.- Type Parameters:
T- the type of elements in the input array- Parameters:
a- the input arrayfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input array that match the given predicate. 0 is returned if the input array/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
public static <T> int count(Collection<? extends T> c, int fromIndex, int toIndex, Predicate<? super T> filter) throws IndexOutOfBoundsException Counts the number of elements within the specified range in the input collection that match the given predicate.- Type Parameters:
T- the type of elements in the input collection- Parameters:
c- the input collectionfromIndex- the starting index (inclusive) of the rangetoIndex- the ending index (exclusive) of the rangefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements within the specified range in the input collection that match the given predicate. 0 is returned if the input collection/range is
nullor empty - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
count
Counts the number of elements in the input iterable that match the given predicate.- Type Parameters:
T- the type of elements in the input iterable- Parameters:
c- the input iterablefilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input iterable is
nullor empty
-
count
Counts the number of elements in the input iterator.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the input iterator- Returns:
- the number of elements in the input iterator. 0 is returned if the input iterator is
nullor empty - Throws:
ArithmeticException- if the total count overflows anint- See Also:
-
count
public static <T> int count(Iterator<? extends T> iter, Predicate<? super T> filter) throws ArithmeticException Counts the number of elements in the input iterator that match the given predicate.- Type Parameters:
T- the type of elements in the input iterator- Parameters:
iter- the input iteratorfilter- the predicate to test if an element should be counted or not.- Returns:
- the number of elements that match the predicate. 0 is returned if the input iterator is
nullor empty - Throws:
ArithmeticException- if the total count overflows anint- See Also:
-
merge
public static <T> List<T> merge(T[] a, T[] b, BiFunction<? super T, ? super T, MergeResult> nextSelector) Merges two the input arrays into a list based where the order of the elements is determined by the given selector function.- Type Parameters:
T- the type of elements in the arrays- Parameters:
a- the first array to mergeb- the second array to mergenextSelector- a function that determines the next element to add to the result list- Returns:
- a list containing the merged elements from both arrays. An empty list is returned if both arrays are
nullor empty. - See Also:
-
merge
public static <T> List<T> merge(Iterable<? extends T> a, Iterable<? extends T> b, BiFunction<? super T, ? super T, MergeResult> nextSelector) Merges two the input iterables into a list based where the order of the elements is determined by the given selector function.- Type Parameters:
T- the type of elements in the iterables- Parameters:
a- the first iterable to mergeb- the second iterable to mergenextSelector- a function that determines the next element to add to the result list- Returns:
- a list containing the merged elements from both iterables. An empty list is returned if both iterables are
nullor empty. - See Also:
-
merge
public static <T> List<T> merge(Collection<? extends Iterable<? extends T>> c, BiFunction<? super T, ? super T, MergeResult> nextSelector) Merges multiple iterables into a list based where the order of the elements is determined by the given selector function.- Type Parameters:
T- the type of elements in the iterables- Parameters:
c- the collection of iterable to mergenextSelector- a function that determines the next element to add to the result list- Returns:
- a list containing the merged elements from all iterables. An empty list is returned if all iterables are
nullor empty. - See Also:
-
merge
public static <T,C extends Collection<T>> C merge(Collection<? extends Iterable<? extends T>> c, BiFunction<? super T, ? super T, MergeResult> nextSelector, IntFunction<? extends C> supplier) Merges multiple iterables into a list based where the order of the elements is determined by the given selector function. The returned collection is created by the specifiedsupplier.- Type Parameters:
T- the type of elements in the iterablesC- the type of the resulting collection- Parameters:
c- the collection of iterable to mergenextSelector- a function that determines the next element to add to the result collectionsupplier- the supplier used to create the returned collection- Returns:
- a collection containing the merged elements from all iterables. An empty collection created by the specified
supplieris returned if all iterables arenullor empty. - See Also:
-
zip
public static <A,B, List<R> zipR> (A[] a, B[] b, BiFunction<? super A, ? super B, ? extends R> zipFunction) Zips two arrays into a single list using the provided zip function. The size of the resulting list is equal to the size of the shorter input array.- Type Parameters:
A- the type of elements in the first arrayB- the type of elements in the second arrayR- the type of elements in the resulting list- Parameters:
a- the first array to zipb- the second array to zipzipFunction- a function that combines elements from the two arrays. An empty list is returned if the one of input arrays isnullor empty.- Returns:
- a list containing the zipped elements
-
zip
public static <A,B, List<R> zipR> (Iterable<A> a, Iterable<B> b, BiFunction<? super A, ? super B, ? extends R> zipFunction) Zips two iterables into a single list using the provided zip function. The size of the resulting list is equal to the size of the shorter input iterable.- Type Parameters:
A- the type of elements in the first iterableB- the type of elements in the second iterableR- the type of elements in the resulting list- Parameters:
a- the first iterable to zipb- the second iterable to zipzipFunction- a function that combines elements from the two iterables. An empty list is returned if the one of input iterables isnullor empty.- Returns:
- a list containing the zipped elements
-
zip
public static <A,B, List<R> zipC, R> (A[] a, B[] b, C[] c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) Zips three arrays into a single list using the provided zip function. The size of the resulting list is equal to the size of the shortest input array.- Type Parameters:
A- the type of elements in the first arrayB- the type of elements in the second arrayC- the type of elements in the third arrayR- the type of elements in the resulting list- Parameters:
a- the first array to zipb- the second array to zipc- the third array to zipzipFunction- a function that combines elements from the three arrays. An empty list is returned if the one of input arrays isnullor empty.- Returns:
- a list containing the zipped elements
-
zip
public static <A,B, List<R> zipC, R> (Iterable<A> a, Iterable<B> b, Iterable<C> c, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) Zips three iterables into a single list using the provided zip function. The size of the resulting list is equal to the size of the shortest input iterables.- Type Parameters:
A- the type of elements in the first iterableB- the type of elements in the second iterableC- the type of elements in the third iterableR- the type of elements in the resulting list- Parameters:
a- the first iterable to zipb- the second iterable to zipc- the third iterable to zipzipFunction- a function that combines elements from the three iterables. An empty list is returned if the one of input iterables isnullor empty.- Returns:
- a list containing the zipped elements
-
zip
public static <A,B, List<R> zipR> (A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction) Zips two arrays into a single list using the provided zip function. If one array is shorter, the provided default values are used for the remaining elements. The size of the resulting list is equal to the size of the longer input array.- Type Parameters:
A- the type of elements in the first arrayB- the type of elements in the second arrayR- the type of elements in the resulting list- Parameters:
a- the first array to zipb- the second array to zipvalueForNoneA- the default value to use if the first array is shortervalueForNoneB- the default value to use if the second array is shorterzipFunction- a function that combines elements from the two arrays- Returns:
- a list containing the zipped elements
-
zip
public static <A,B, List<R> zipR> (Iterable<A> a, Iterable<B> b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, ? extends R> zipFunction) Zips two iterables into a single list using the provided zip function. If one iterable is shorter, the provided default values are used for the remaining elements. The size of the resulting list is equal to the size of the longer input iterable.- Type Parameters:
A- the type of elements in the first iterableB- the type of elements in the second iterableR- the type of elements in the resulting list- Parameters:
a- the first iterable to zipb- the second iterable to zipvalueForNoneA- the default value to use if the first iterable is shortervalueForNoneB- the default value to use if the second iterable is shorterzipFunction- a function that combines elements from the two iterables- Returns:
- a list containing the zipped elements
-
zip
public static <A,B, List<R> zipC, R> (A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) Zips three arrays into a single list using the provided zip function. If one array is shorter, the provided default values are used for the remaining elements. The size of the resulting list is equal to the size of the longest input array.- Type Parameters:
A- the type of elements in the first arrayB- the type of elements in the second arrayC- the type of elements in the third arrayR- the type of elements in the resulting list- Parameters:
a- the first array to zipb- the second array to zipc- the third array to zipvalueForNoneA- the default value to use if the first array is shortervalueForNoneB- the default value to use if the second array is shortervalueForNoneC- the default value to use if the third array is shorterzipFunction- a function that combines elements from the three arrays- Returns:
- a list containing the zipped elements
-
zip
public static <A,B, List<R> zipC, R> (Iterable<A> a, Iterable<B> b, Iterable<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, ? super C, ? extends R> zipFunction) Zips three iterables into a single list using the provided zip function. If one iterable is shorter, the provided default values are used for the remaining elements. The size of the resulting list is equal to the size of the longest input iterable.- Type Parameters:
A- the type of elements in the first iterableB- the type of elements in the second iterableC- the type of elements in the third iterableR- the type of elements in the resulting list- Parameters:
a- the first iterable to zipb- the second iterable to zipc- the third iterable to zipvalueForNoneA- the default value to use if the first iterable is shortervalueForNoneB- the default value to use if the second iterable is shortervalueForNoneC- the default value to use if the third iterable is shorterzipFunction- a function that combines elements from the three iterables- Returns:
- a list containing the zipped elements
-
zip
public static <A,B, R[] zipR> (A[] a, B[] b, BiFunction<? super A, ? super B, throws IllegalArgumentException? extends R> zipFunction, Class<R> targetElementType) Zips two arrays into a single array using the provided zip function. The size of the resulting array is equal to the size of the shorter input array.- Type Parameters:
A- the type of elements in the first arrayB- the type of elements in the second arrayR- the type of elements in the resulting array- Parameters:
a- the first array to zipb- the second array to zipzipFunction- a function that combines elements from the two arrays. An empty list is returned if the one of input arrays isnullor empty.targetElementType- the class of the resulting array's element type- Returns:
- a list containing the zipped elements
- Throws:
IllegalArgumentException- if the targetElementType is null
-
zip
public static <A,B, R[] zipR> (A[] a, B[] b, A valueForNoneA, B valueForNoneB, BiFunction<? super A, ? super B, throws IllegalArgumentException? extends R> zipFunction, Class<R> targetElementType) Zips two arrays into a single array using the provided zip function. If one array is shorter, the provided default values are used for the remaining elements. The size of the resulting array is equal to the size of the longer input array.- Type Parameters:
A- the type of elements in the first arrayB- the type of elements in the second arrayR- the type of elements in the resulting array- Parameters:
a- the first array to zipb- the second array to zipvalueForNoneA- the default value to use if the first array is shortervalueForNoneB- the default value to use if the second array is shorterzipFunction- a function that combines elements from the two arraystargetElementType- the class of the resulting array's element type- Returns:
- a list containing the zipped elements
- Throws:
IllegalArgumentException- if the targetElementType is null
-
zip
public static <A,B, R[] zipC, R> (A[] a, B[] b, C[] c, TriFunction<? super A, ? super B, throws IllegalArgumentException? super C, ? extends R> zipFunction, Class<R> targetElementType) Zips three arrays into a single array using the provided zip function. The size of the resulting array is equal to the size of the shortest input array.- Type Parameters:
A- the type of elements in the first arrayB- the type of elements in the second arrayC- the type of elements in the third arrayR- the type of elements in the resulting array- Parameters:
a- the first array to zipb- the second array to zipc- the third array to zipzipFunction- a function that combines elements from the three arrays. An empty list is returned if the one of input arrays isnullor empty.targetElementType- the class of the resulting array's element type- Returns:
- a list containing the zipped elements
- Throws:
IllegalArgumentException- if the targetElementType is null
-
zip
public static <A,B, R[] zipC, R> (A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, TriFunction<? super A, ? super B, throws IllegalArgumentException? super C, ? extends R> zipFunction, Class<R> targetElementType) Zips three arrays into a single array using the provided zip function. If one array is shorter, the provided default values are used for the remaining elements. The size of the resulting array is equal to the size of the longest input array.- Type Parameters:
A- the type of elements in the first arrayB- the type of elements in the second arrayC- the type of elements in the third arrayR- the type of elements in the resulting array- Parameters:
a- the first array to zipb- the second array to zipc- the third array to zipvalueForNoneA- the default value to use if the first array is shortervalueForNoneB- the default value to use if the second array is shortervalueForNoneC- the default value to use if the third array is shorterzipFunction- a function that combines elements from the three arraystargetElementType- the class of the resulting array's element type- Returns:
- a list containing the zipped elements
- Throws:
IllegalArgumentException- if the targetElementType is null
-
unzip
public static <T,A, Pair<List<A>,B> List<B>> unzip(Iterable<? extends T> c, BiConsumer<? super T, Pair<A, B>> unzip) Unzips an iterable into two separate lists using the provided unzip function.- Type Parameters:
T- the type of elements in the input iterableA- the type of elements in the first output listB- the type of elements in the second output list- Parameters:
c- the input iterable to unzipunzip- a function that takes an element from the input iterable and a pair, and populates the pair with the unzipped values- Returns:
- a pair of lists, where the first list contains the first elements and the second list contains the second elements
-
unzip
public static <T,A, Pair<LC,B, LC extends Collection<A>, RC extends Collection<B>> RC> unzip(Iterable<? extends T> c, BiConsumer<? super T, Pair<A, B>> unzip, IntFunction<? extends Collection<?>> supplier) Unzips an iterable into two separate collections using the provided unzip function.- Type Parameters:
T- the type of elements in the input iterableA- the type of elements in the first output collectionB- the type of elements in the second output collectionLC- the type of the first output collectionRC- the type of the second output collection- Parameters:
c- the input iterable to unzipunzip- a function that takes an element from the input iterable and a pair, and populates the pair with the unzipped valuessupplier- a function that provides new instances of the output collections- Returns:
- a pair of lists, where the first collection contains the first elements and the second collection contains the second elements
-
unzipp
@Deprecated public static <T,A, Triple<List<A>,B, C> List<B>, unzippList<C>> (Iterable<? extends T> c, BiConsumer<? super T, Triple<A, B, C>> unzip) Deprecated.replaced byTriIterator.unzip(Iterable, BiConsumer)Unzips an iterable into three separate lists using the provided unzip function.- Type Parameters:
T- the type of elements in the input iterableA- the type of elements in the first output listB- the type of elements in the second output listC- the type of elements in the third output list- Parameters:
c- the input iterable to unzipunzip- a function that takes an element from the input iterable and a triple, and populates the triple with the unzipped values- Returns:
- a triple of lists, where the first list contains the first elements, the second list contains the second elements and the third list contains the third elements
- See Also:
-
unzipp
@Deprecated public static <T,A, Triple<LC,B, C, LC extends Collection<A>, MC extends Collection<B>, RC extends Collection<C>> MC, unzippRC> (Iterable<? extends T> c, BiConsumer<? super T, Triple<A, B, C>> unzip, IntFunction<? extends Collection<?>> supplier) Deprecated.replaced byinvalid reference
TriIterator#unzip(Iterable, BiConsumer, Supplier)Unzips an iterable into three separate collections using the provided unzip function.- Type Parameters:
T- the type of elements in the input iterableA- the type of elements in the first output collectionB- the type of elements in the second output collectionC- the type of elements in the third output collectionLC- the type of the first output collectionMC- the type of the second output collectionRC- the type of the third output collection- Parameters:
c- the input iterable to unzipunzip- a function that takes an element from the input iterable and a triple, and populates the triple with the unzipped valuessupplier- a function that provides new instances of the output collections- Returns:
- a triple of collections, where the first collection contains the first elements, the second collection contains the second elements and the third collection contains the third elements
- See Also:
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(T[] a, Function<? super T, ? extends K> keyExtractor) Groups the elements in the given array by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the arrayK- the type of keys- Parameters:
a- the array to groupkeyExtractor- a function to extract the key for grouping- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements that share the same key. An empty map is returned if the input array is
nullor empty.
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (T[] a, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Groups the elements in the given array by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the arrayK- the type of keysM- the type of returned map- Parameters:
a- the array to groupkeyExtractor- a function to extract the key for groupingmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements that share the same key. An empty map is returned if the input array is
nullor empty.
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(T[] a, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor) Groups the elements within specified range in the given array by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the arrayK- the type of keys- Parameters:
a- the array to groupfromIndex- the index of the first element (inclusive) to be groupedtoIndex- the index of the last element (exclusive) to be groupedkeyExtractor- a function to extract the key for grouping- Returns:
- a map where the keys are extracted from the elements within specified range and the values are lists of elements that share the same key. An empty map is returned if the input array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (T[] a, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) throws IndexOutOfBoundsExceptionGroups the elements within specified range in the given array by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the arrayK- the type of keysM- the type of returned map- Parameters:
a- the array to groupfromIndex- the index of the first element (inclusive) to be groupedtoIndex- the index of the last element (exclusive) to be groupedkeyExtractor- a function to extract the key for groupingmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements within specified range and the values are lists of elements that share the same key. An empty map is returned if the input array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor) Groups the elements within specified range in the given collection by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the collectionK- the type of keys- Parameters:
fromIndex- the index of the first element (inclusive) to be groupedtoIndex- the index of the last element (exclusive) to be groupedkeyExtractor- a function to extract the key for groupinga- the collection to group- Returns:
- a map where the keys are extracted from the elements within specified range and the values are lists of elements that share the same key. An empty map is returned if the input collection is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (Collection<? extends T> c, int fromIndex, int toIndex, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) throws IndexOutOfBoundsExceptionGroups the elements within specified range in the given collection by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the collectionK- the type of keysM- the type of returned map- Parameters:
fromIndex- the index of the first element (inclusive) to be groupedtoIndex- the index of the last element (exclusive) to be groupedkeyExtractor- a function to extract the key for groupingmapSupplier- a function to create the returned mapa- the collection to group- Returns:
- a map where the keys are extracted from the elements within specified range and the values are lists of elements that share the same key. An empty map is returned if the collection array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor) Groups the elements in the given iterable by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the iterableK- the type of keys- Parameters:
c- the iterable to groupkeyExtractor- a function to extract the key for grouping- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements that share the same key. An empty map is returned if the input iterable is
nullor empty.
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Groups the elements in the given iterable by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the iterableK- the type of keysM- the type of returned map- Parameters:
c- the iterable to groupkeyExtractor- a function to extract the key for groupingmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements that share the same key. An empty map is returned if the input iterable is
nullor empty.
-
groupBy
@Beta public static <T,K> Map<K,List<T>> groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the iteratorK- the type of keys- Parameters:
iter- the iterator to groupkeyExtractor- a function to extract the key for grouping- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements that share the same key. An empty map is returned if the input iterator is
nullor empty.
-
groupBy
@Beta public static <T,K, M groupByM extends Map<K, List<T>>> (Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>.- Type Parameters:
T- the type of elements in the iteratorK- the type of keysM- the type of returned map- Parameters:
iter- the iterator to groupkeyExtractor- a function to extract the key for groupingmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements that share the same key. An empty map is returned if the input iterator is
nullor empty.
-
groupBy
@Beta public static <T,K, Map<K,V> List<V>> groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) Groups the elements in the given iterable by the key extracted by the specifiedFunction<T, K>. The values in the resulting map are lists of elements transformed by the value extractor function.- Type Parameters:
T- the type of elements in the input iterableK- the type of keysV- the type of values in the resulting lists- Parameters:
c- the input iterable to groupkeyExtractor- a function to extract the key for groupingvalueExtractor- a function to extract the value for the resulting lists- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements transformed by the value extractor function. An empty map is returned if the input iterable is
nullor empty.
-
groupBy
@Beta public static <T,K, M groupByV, M extends Map<K, List<V>>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<M> mapSupplier) Groups the elements in the given iterable by the key extracted by the specifiedFunction<T, K>. The values in the resulting map are lists of elements transformed by the value extractor function.- Type Parameters:
T- the type of elements in the input iterableK- the type of keysV- the type of values in the resulting listsM- the type of returned map- Parameters:
c- the input iterable to groupkeyExtractor- a function to extract the key for groupingvalueExtractor- a function to extract the value for the resulting listsmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements transformed by the value extractor function. An empty map is returned if the input iterable is
nullor empty.
-
groupBy
@Beta public static <T,K, Map<K,V> List<V>> groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>. The values in the resulting map are lists of elements transformed by the value extractor function.- Type Parameters:
T- the type of elements in the input iteratorK- the type of keysV- the type of values in the resulting lists- Parameters:
iter- the input iterator to groupkeyExtractor- a function to extract the key for groupingvalueExtractor- a function to extract the value for the resulting lists- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements transformed by the value extractor function. An empty map is returned if the input iterator is
nullor empty.
-
groupBy
@Beta public static <T,K, M groupByV, M extends Map<K, List<V>>> (Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<M> mapSupplier) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>. The values in the resulting map are lists of elements transformed by the value extractor function.- Type Parameters:
T- the type of elements in the input iteratorK- the type of keysV- the type of values in the resulting listsM- the type of returned map- Parameters:
iter- the input iterator to groupkeyExtractor- a function to extract the key for groupingvalueExtractor- a function to extract the value for the resulting listsmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements and the values are lists of elements transformed by the value extractor function. An empty map is returned if the input iterator is
nullor empty.
-
groupBy
@Beta public static <T,K, Map<K,R> R> groupBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector) Groups the elements in the given array by the key extracted by the specifiedFunction<T, K>. The values in the resulting map are transformed by the specified collector.- Type Parameters:
T- the type of elements in the arrayK- the type of keysR- the type of values in the resulting map- Parameters:
keyExtractor- a function to extract the key for groupingcollector- a collector that transforms the valuesa- the array to group- Returns:
- a map where the keys are extracted from the elements and the values are transformed by the collector. An empty map is returned if the input array is
nullor empty.
-
groupBy
@Beta public static <T,K, M groupByR, M extends Map<K, R>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector, Supplier<M> mapSupplier) Groups the elements in the given array by the key extracted by the specifiedFunction<T, K>. The values in the resulting map are transformed by the specified collector.- Type Parameters:
T- the type of elements in the arrayK- the type of keysR- the type of values in the resulting mapM- the type of returned map- Parameters:
keyExtractor- a function to extract the key for groupingcollector- a collector that transforms the valuesmapSupplier- a function to create the returned mapa- the array to group- Returns:
- a map where the keys are extracted from the elements and the values are transformed by the collector. An empty map is returned if the input array is
nullor empty.
-
groupBy
@Beta public static <K,T, Map<K,R> R> groupBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>. The values in the resulting map are transformed by the specified collector.- Type Parameters:
K- the type of keysT- the type of elements in the iteratorR- the type of values in the resulting map- Parameters:
iter- the iterator to groupkeyExtractor- a function to extract the key for groupingcollector- a collector that transforms the values- Returns:
- a map where the keys are extracted from the elements and the values are transformed by the collector. An empty map is returned if the input iterator is
nullor empty.
-
groupBy
@Beta public static <K,T, M groupByR, M extends Map<K, R>> (Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Collector<? super T, ?, R> collector, Supplier<M> mapSupplier) Groups the elements in the given iterator by the key extracted by the specifiedFunction<T, K>. The values in the resulting map are transformed by the specified collector.- Type Parameters:
K- the type of keysT- the type of elements in the iteratorR- the type of values in the resulting mapM- the type of returned map- Parameters:
iter- the iterator to groupkeyExtractor- a function to extract the key for groupingcollector- a collector that transforms the valuesmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements and the values are transformed by the collector. An empty map is returned if the input iterator is
nullor empty.
-
countBy
@Beta public static <T,K> Map<K,Integer> countBy(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor) Counts the elements in the given iterable by the key extracted by the specifiedFunction<T, K>. The resulting map contains the keys and the count of elements associated with each key.- Type Parameters:
T- the type of elements in the input iterableK- the type of keys- Parameters:
c- the input iterable to countkeyExtractor- a function to extract the key for counting- Returns:
- a map where the keys are extracted from the elements and the values are the count of elements associated with each key. An empty map is returned if the input iterable is
nullor empty.
-
countBy
@Beta public static <T,K, M countByM extends Map<K, Integer>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Counts the elements in the given iterable by the key extracted by the specifiedFunction<T, K>. The resulting map contains the keys and the count of elements associated with each key.- Type Parameters:
T- the type of elements in the input iterableK- the type of keysM- the type of returned map- Parameters:
c- the input iterable to countkeyExtractor- a function to extract the key for countingmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements and the values are the count of elements associated with each key. An empty map is returned if the input iterable is
nullor empty.
-
countBy
@Beta public static <T,K> Map<K,Integer> countBy(Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor) Counts the elements in the given iterator by the key extracted by the specifiedFunction<T, K>. The resulting map contains the keys and the count of elements associated with each key.- Type Parameters:
T- the type of elements in the input iteratorK- the type of keys- Parameters:
iter- the input iterator to countkeyExtractor- a function to extract the key for counting- Returns:
- a map where the keys are extracted from the elements and the values are the count of elements associated with each key. An empty map is returned if the input iterator is
nullor empty.
-
countBy
@Beta public static <T,K, M countByM extends Map<K, Integer>> (Iterator<? extends T> iter, Function<? super T, ? extends K> keyExtractor, Supplier<M> mapSupplier) Counts the elements in the given iterator by the key extracted by the specifiedFunction<T, K>. The resulting map contains the keys and the count of elements associated with each key.- Type Parameters:
T- the type of elements in the input iteratorK- the type of keysM- the type of returned map- Parameters:
iter- the input iterator to countkeyExtractor- a function to extract the key for countingmapSupplier- a function to create the returned map- Returns:
- a map where the keys are extracted from the elements and the values are the count of elements associated with each key. An empty map is returned if the input iterator is
nullor empty.
-
iterate
Returns an iterator over the elements in the specified array.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to iterate over- Returns:
- an iterator over the elements in the specified array
- See Also:
-
iterate
@Beta public static <T> ObjIterator<T> iterate(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns an iterator over the elements within specified range in the given array.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to iterate overfromIndex- the index of the first element (inclusive) to be iteratedtoIndex- the index of the last element (exclusive) to be iterated- Returns:
- an iterator over the elements within specified range in the specified array
- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
iterate
Returns an iterator over the elements in the specified iterable.- Type Parameters:
T- the type of elements in the iterable- Parameters:
c- the iterable to iterate over- Returns:
- an iterator over the elements in the specified iterable
- See Also:
-
iterateAll
@Beta public static <T> List<Iterator<T>> iterateAll(Collection<? extends Iterable<? extends T>> iterables) Returns a list of iterators for each iterable in the specified collection of iterables.- Type Parameters:
T- the type of elements in the iterables- Parameters:
iterables- the collection of iterables to iterate over- Returns:
- a list of iterators for each iterable in the specified collection
-
disjoint
Checks if the two specified arrays have no elements in common.- Parameters:
a- the first array to be checkedb- the second array to be checked- Returns:
trueif the two arrays have no elements in common or either of specified arrays isnullor empty,falseotherwise.- See Also:
-
disjoint
Checks if the two specified collections have no elements in common.- Parameters:
c1- the first collection to be checkedc2- the second collection to be checked- Returns:
trueif the two collections have no elements in common or either of specified collections isnullor empty,falseotherwise.- See Also:
-
toJson
Converts the given object to its JSON string representation.- Parameters:
obj- the object to be converted to JSON- Returns:
- a JSON string representation in the given object
-
toJson
Converts the given object to its JSON string representation with an option for pretty formatting.- Parameters:
obj- the object to be converted to JSONprettyFormat- a boolean flag that indicates whether the output JSON should be formatted with indents and line breaks for easier reading or not.- Returns:
- a JSON string representation in the given object.
-
toJson
Converts the given object to its JSON string representation with the specifiedJSONSerializationConfig.- Parameters:
obj- the object to be converted to JSONconfig- the JSON serialization configuration- Returns:
- a JSON string representation in the given object
-
toJson
Converts the given object to its JSON string representation and writes it to the specified file.- Parameters:
obj- the object to be converted to JSONoutput- the file to which the JSON string representation of the object will be written
-
toJson
Converts the given object to its JSON string representation with an option for pretty formatting and writes it to the specified file.- Parameters:
obj- the object to be converted to JSONconfig- the JSON serialization configurationoutput- the file to which the JSON string representation of the object will be written
-
toJson
Converts the given object to its JSON string representation and writes it to the specified output stream.- Parameters:
obj- the object to be converted to JSONoutput- the output stream to which the JSON string representation of the object will be written
-
toJson
Converts the given object to its JSON string representation with an option for pretty formatting and writes it to the specified output stream.- Parameters:
obj- the object to be converted to JSONconfig- the JSON serialization configurationoutput- the output stream to which the JSON string representation of the object will be written
-
toJson
Converts the given object to its JSON string representation and writes it to the specified writer.- Parameters:
obj- the object to be converted to JSONoutput- the writer to which the JSON string representation of the object will be written
-
toJson
Converts the given object to its JSON string representation with an option for pretty formatting and writes it to the specified writer.- Parameters:
obj- the object to be converted to JSONconfig- the JSON serialization configurationoutput- the writer to which the JSON string representation of the object will be written
-
fromJson
Deserializes the given JSON string into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
Deserializes the given JSON string into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
Deserializes the given JSON string into an object of the specified target type. If the deserialized object isnull, returns the provided default value.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializeddefaultIfNull- the default value to return if the deserialized object is nulltargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string, or defaultIfNull if the deserialized object is null
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(String json, T defaultIfNull, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string into an object of the specified target type. If the deserialized object isnull, returns the provided default value.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, DatetargetType- can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the JSON string, or defaultIfNull if the deserialized object is null
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(String json, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON string into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(String json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
Deserializes the given JSON string from the specified file into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the file where the given JSON string is read to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
Deserializes the given JSON string from the specified file into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the file where the given JSON string is read to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(File json, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON string from the specified file into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the file where the given JSON string is read to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(File json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string from the specified file into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the file where the given JSON string is read to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
Deserializes the given JSON string from the specified input stream into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the input stream where the given JSON string is read to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(InputStream json, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string from the specified input stream into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the input stream where the given JSON string is read to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(InputStream json, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON string from the specified input stream into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the input stream where the given JSON string is read to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(InputStream json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string from the specified input stream into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the input stream where the given JSON string is read to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
Deserializes the given JSON string from the specified reader into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the reader where the given JSON string is read to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
Deserializes the given JSON string from the specified reader into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the reader where the given JSON string is read to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(Reader json, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON string from the specified reader into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the reader where the given JSON string is read to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(Reader json, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given JSON string from the specified reader into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the reader where the given JSON string is read to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromJson
public static <T> T fromJson(String json, int fromIndex, int toIndex, Class<? extends T> targetType) throws IndexOutOfBoundsException Deserializes the given JSON sub-string in the specified range into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedfromIndex- the index of the first character (inclusive) to be deserializedtoIndex- the index of the last character (exclusive) to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
fromJson
public static <T> T fromJson(String json, int fromIndex, int toIndex, com.landawn.abacus.type.Type<? extends T> targetType) throws IndexOutOfBoundsException Deserializes the given JSON sub-string in the specified range into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedfromIndex- the index of the first character (inclusive) to be deserializedtoIndex- the index of the last character (exclusive) to be deserializedtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
fromJson
public static <T> T fromJson(String json, int fromIndex, int toIndex, JSONDeserializationConfig config, Class<? extends T> targetType) Deserializes the given JSON sub-string in the specified range into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IllegalArgumentException- if the specified target type isnull.IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
fromJson
public static <T> T fromJson(String json, int fromIndex, int toIndex, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) throws IndexOutOfBoundsException Deserializes the given JSON sub-string in the specified range into an object of the specified target type with the specifiedJSONDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
json- the JSON string to be deserializedfromIndex- the index of the first character (inclusive) to be deserializedtoIndex- the index of the last character (exclusive) to be deserializedconfig- the JSON deserialization configurationtargetType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- an object of type T deserialized from the JSON string
- Throws:
IndexOutOfBoundsException- if the specified range is out of boundsIllegalArgumentException- if the specified target type isnull.- See Also:
-
streamJson
Creates a stream of elements deserialized from the given JSON array string with the specified target type.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the JSON array string to be streamedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(String jsonArray, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array string with the specified target type.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the JSON array string to be streamedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(String jsonArray, JSONDeserializationConfig config, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array string with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the JSON array string to be streamedconfig- the JSON deserialization configurationelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(String jsonArray, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array string with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the JSON array string to be streamedconfig- the JSON deserialization configurationelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
Creates a stream of elements deserialized from the given JSON array in the specified file with the specified target type.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the JSON array file to be streamedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(File jsonArray, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified file with the specified target type.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the JSON array file to be streamedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(File jsonArray, JSONDeserializationConfig config, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified file with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the JSON array file to be streamedconfig- the JSON deserialization configurationelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(File jsonArray, JSONDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified file with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the JSON array file to be streamedconfig- the JSON deserialization configurationelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the input stream where the given JSON array is read to be streamedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(InputStream jsonArray, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the input stream where the given JSON array is read to be streamedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(InputStream jsonArray, boolean closeInputStreamWhenStreamIsClosed, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the input stream where the given JSON array is read to be streamedcloseInputStreamWhenStreamIsClosed- the flag indicating whether to close the input stream when the stream is closedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(InputStream jsonArray, boolean closeInputStreamWhenStreamIsClosed, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the input stream where the given JSON array is read to be streamedcloseInputStreamWhenStreamIsClosed- the flag indicating whether to close the input stream when the stream is closedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(InputStream jsonArray, JSONDeserializationConfig config, boolean closeInputStreamWhenStreamIsClosed, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the input stream where the given JSON array is read to be streamedconfig- the JSON deserialization configurationcloseInputStreamWhenStreamIsClosed- the flag indicating whether to close the input stream when the stream is closedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(InputStream jsonArray, JSONDeserializationConfig config, boolean closeInputStreamWhenStreamIsClosed, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified input stream with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the input stream where the given JSON array is read to be streamedconfig- the JSON deserialization configurationcloseInputStreamWhenStreamIsClosed- the flag indicating whether to close the input stream when the stream is closedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the reader where the given JSON array is read to be streamedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(Reader jsonArray, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the reader where the given JSON array is read to be streamedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(Reader jsonArray, boolean closeReaderWhenStreamIsClosed, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the reader where the given JSON array is read to be streamedcloseReaderWhenStreamIsClosed- the flag indicating whether to close the reader when the stream is closedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(Reader jsonArray, boolean closeReaderWhenStreamIsClosed, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the reader where the given JSON array is read to be streamedcloseReaderWhenStreamIsClosed- the flag indicating whether to close the reader when the stream is closedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(Reader jsonArray, JSONDeserializationConfig config, boolean closeReaderWhenStreamIsClosed, Class<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the reader where the given JSON array is read to be streamedconfig- the JSON deserialization configurationcloseReaderWhenStreamIsClosed- the flag indicating whether to close the reader when the stream is closedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
streamJson
public static <T> Stream<T> streamJson(Reader jsonArray, JSONDeserializationConfig config, boolean closeReaderWhenStreamIsClosed, com.landawn.abacus.type.Type<? extends T> elementType) Creates a stream of elements deserialized from the given JSON array in the specified reader with the specified target type andJSONDeserializationConfig.- Type Parameters:
T- the type of the elements in the JSON array- Parameters:
jsonArray- the reader where the given JSON array is read to be streamedconfig- the JSON deserialization configurationcloseReaderWhenStreamIsClosed- the flag indicating whether to close the reader when the stream is closedelementType- the type the given JSON array element will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- a stream of elements deserialized from the given JSON array
- Throws:
IllegalArgumentException- if the specified element type isnull.- See Also:
-
formatJson
Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.- Parameters:
json- the JSON string to be formatted- Returns:
- the formatted JSON string
-
formatJson
Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.- Parameters:
json- the JSON string to be formattedtransferType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- the formatted JSON string
-
formatJson
Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.- Parameters:
json- the JSON string to be formattedtransferType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- the formatted JSON string
-
formatJson
Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.- Parameters:
json- the JSON string to be formattedconfig- the JSON serialization configuration- Returns:
- the formatted JSON string
-
formatJson
Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.- Parameters:
json- the JSON string to be formattedconfig- the JSON serialization configurationtransferType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- the formatted JSON string
-
formatJson
public static String formatJson(String json, JSONSerializationConfig config, com.landawn.abacus.type.Type<?> transferType) Formats the given JSON string to its pretty-printed JSON format with indents and line breaks for easier reading.- Parameters:
json- the JSON string to be formattedconfig- the JSON serialization configurationtransferType- the type the given JSON string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSetor serializable single value type, e.g.String, Integer, Date- Returns:
- the formatted JSON string
-
toXml
Converts the given object into an XML string representation.- Parameters:
obj- the object to be converted into an XML string.- Returns:
- an XML string representation in the given object.
-
toXml
Converts the given object to its XML string representation with an option for pretty formatting.- Parameters:
obj- the object to be converted to XMLprettyFormat- a boolean flag that indicates whether the output XML should be formatted with indents and line breaks for easier reading or not.- Returns:
- a XML string representation in the given object.
-
toXml
Converts the given object to its XML string representation with the specifiedXMLSerializationConfig.- Parameters:
obj- the object to be converted to XMLconfig- the XML serialization configuration- Returns:
- a XML string representation in the given object.
-
toXml
Converts the given object to its XML string representation and writes it to the specified file.- Parameters:
obj- the object to be converted to XMLoutput- the file to which the XML string representation of the object will be written
-
toXml
Converts the given object to its XML string representation with the specifiedXMLSerializationConfigand writes it to the specified file.- Parameters:
obj- the object to be converted to XMLconfig- the XML serialization configurationoutput- the file to which the XML string representation of the object will be written
-
toXml
Converts the given object to its XML string representation and writes it to the specified output stream.- Parameters:
obj- the object to be converted to XMLoutput- the output stream to which the XML string representation of the object will be written
-
toXml
Converts the given object to its XML string representation with the specifiedXMLSerializationConfigand writes it to the specified output stream.- Parameters:
obj- the object to be converted to XMLconfig- the XML serialization configurationoutput- the output stream to which the XML string representation of the object will be written
-
toXml
Converts the given object to its XML string representation and writes it to the specified writer.- Parameters:
obj- the object to be converted to XMLoutput- the writer to which the XML string representation of the object will be written
-
toXml
Converts the given object to its XML string representation with the specifiedXMLSerializationConfigand writes it to the specified writer.- Parameters:
obj- the object to be converted to XMLconfig- the XML serialization configurationoutput- the writer to which the XML string representation of the object will be written
-
fromXml
Deserializes the given XML string into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the XML string to be deserializedtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
Deserializes the given XML string into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the XML string to be deserializedtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
public static <T> T fromXml(String xml, XMLDeserializationConfig config, Class<? extends T> targetType) Deserializes the given XML string into an object of the specified target type with the specifiedXMLDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the XML string to be deserializedconfig- the XML deserialization configurationtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
public static <T> T fromXml(String xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string into an object of the specified target type with the specifiedXMLDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the XML string to be deserializedconfig- the XML deserialization configurationtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
Deserializes the given XML string from the specified file into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the file where the given XML string is read to be deserializedtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
Deserializes the given XML string from the specified file into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the file where the given XML string is read to be deserializedtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
public static <T> T fromXml(File xml, XMLDeserializationConfig config, Class<? extends T> targetType) Deserializes the given XML string from the specified file into an object of the specified target type with the specifiedXMLDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the file where the given XML string is read to be deserializedconfig- the XML deserialization configurationtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
public static <T> T fromXml(File xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string from the specified file into an object of the specified target type with the specifiedXMLDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the file where the given XML string is read to be deserializedconfig- the XML deserialization configurationtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
Deserializes the given XML string from the specified input stream into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the input stream where the given XML string is read to be deserializedtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
Deserializes the given XML string from the specified input stream into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the input stream where the given XML string is read to be deserializedtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
public static <T> T fromXml(InputStream xml, XMLDeserializationConfig config, Class<? extends T> targetType) Deserializes the given XML string from the specified input stream into an object of the specified target type with the specifiedXMLDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the input stream where the given XML string is read to be deserializedconfig- the XML deserialization configurationtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
public static <T> T fromXml(InputStream xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string from the specified input stream into an object of the specified target type with the specifiedXMLDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the input stream where the given XML string is read to be deserializedconfig- the XML deserialization configurationtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
Deserializes the given XML string from the specified reader into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the reader where the given XML string is read to be deserializedtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
Deserializes the given XML string from the specified reader into an object of the specified target type.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the reader where the given XML string is read to be deserializedtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
public static <T> T fromXml(Reader xml, XMLDeserializationConfig config, Class<? extends T> targetType) Deserializes the given XML string from the specified reader into an object of the specified target type with the specifiedXMLDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the reader where the given XML string is read to be deserializedconfig- the XML deserialization configurationtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
fromXml
public static <T> T fromXml(Reader xml, XMLDeserializationConfig config, com.landawn.abacus.type.Type<? extends T> targetType) Deserializes the given XML string from the specified reader into an object of the specified target type with the specifiedXMLDeserializationConfig.- Type Parameters:
T- the type of the object to be returned- Parameters:
xml- the reader where the given XML string is read to be deserializedconfig- the XML deserialization configurationtargetType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map.- Returns:
- an object of type T deserialized from the XML string
- Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
formatXml
Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading.- Parameters:
xml- the XML string to be formatted- Returns:
- the formatted XML string
-
formatXml
Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading.- Parameters:
xml- the XML string to be formattedtransferType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- the formatted XML string
-
formatXml
Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading.- Parameters:
xml- the XML string to be formattedtransferType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- the formatted XML string
-
formatXml
Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading with the specifiedXMLSerializationConfig.- Parameters:
xml- the XML string to be formattedconfig- the XML serialization configuration- Returns:
- the formatted XML string
-
formatXml
Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading with the specifiedXMLSerializationConfig- Parameters:
xml- the XML string to be formattedconfig- the XML serialization configurationtransferType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- the formatted XML string
-
formatXml
public static String formatXml(String xml, XMLSerializationConfig config, com.landawn.abacus.type.Type<?> transferType) Formats the given XML string to its pretty-printed XML format with indents and line breaks for easier reading with the specifiedXMLSerializationConfig- Parameters:
xml- the XML string to be formattedconfig- the XML serialization configurationtransferType- the type the given XML string will be deserialized to. It can be theTypeofBean/Array/Collection/Map/DataSet.- Returns:
- the formatted XML string
-
xml2Json
Converts the given XML string to its JSON string representation.- Parameters:
xml- the XML string to be converted to JSON- Returns:
- the JSON string representation in the given XML
-
xml2Json
Converts the given XML string to its JSON string representation.- Parameters:
xml- the XML string to be converted to JSONtransferType- the type of intermediate object the given XML string will be deserialized for conversion. It only can be theTypeofBean/Map.- Returns:
- the JSON string representation in the given XML
-
json2Xml
Converts the given JSON string to its XML string representation.- Parameters:
json- the JSON string to be converted to XML- Returns:
- the XML string representation in the given JSON
-
json2Xml
Converts the given JSON string to its XML string representation.- Parameters:
json- the JSON string to be converted to XMLtransferType- the type of intermediate object the given JSON string will be deserialized for conversion. It only can be theTypeofBean/Map.- Returns:
- the XML string representation in the given JSON
-
forEach
public static <E extends Exception> void forEach(int startInclusive, int endExclusive, Throwables.Runnable<E> action) throws E Executes the providedactionfor each value in the range defined bystartInclusiveandendExclusive.- Type Parameters:
E- the type of the exception that the action may throw- Parameters:
startInclusive- the start value of the range (inclusive)endExclusive- the end value of the range (exclusive)action- the action to be performed for each value in the range- Throws:
E- if the action throws an exception
-
forEach
public static <E extends Exception> void forEach(int startInclusive, int endExclusive, int step, Throwables.Runnable<E> action) throws IllegalArgumentException, E Executes the providedactionfor each value in the range defined bystartInclusive,endExclusiveandstep.- Type Parameters:
E- the type of the exception that the action may throw- Parameters:
startInclusive- the start value of the range (inclusive)endExclusive- the end value of the range (exclusive)step- the increment value for each iteration in the range. It can be positive or negative but not zero.action- the action to be performed for each value in the range- Throws:
IllegalArgumentException- if the step is zeroE- if the action throws an exception
-
forEach
public static <E extends Exception> void forEach(int startInclusive, int endExclusive, Throwables.IntConsumer<E> action) throws E Executes the providedactionfor each value in the range defined bystartInclusiveandendExclusive.- Type Parameters:
E- the type of the exception that the action may throw- Parameters:
startInclusive- the start value of the range (inclusive)endExclusive- the end value of the range (exclusive)action- the action to be performed for each value in the range- Throws:
E- if the action throws an exception
-
forEach
public static <E extends Exception> void forEach(int startInclusive, int endExclusive, int step, Throwables.IntConsumer<E> action) throws E Executes the providedactionfor each value in the range defined bystartInclusive,endExclusiveandstep.- Type Parameters:
E- the type of the exception that the action may throw- Parameters:
startInclusive- the start value of the range (inclusive)endExclusive- the end value of the range (exclusive)step- the increment value for each iteration in the range. It can be positive or negative but not zero.action- the action to be performed for each value in the range- Throws:
IllegalArgumentException- if the step is zeroE- if the action throws an exception
-
forEach
public static <T,E extends Exception> void forEach(int startInclusive, int endExclusive, T a, Throwables.IntObjConsumer<? super T, E> action) throws EExecutes the providedactionfor each value in the range defined bystartInclusiveandendExclusive, passing the current index and the provided objectato the action.- Type Parameters:
T- the type of the object passed to the actionE- the type of the exception that the action may throw- Parameters:
startInclusive- the start value of the range (inclusive)endExclusive- the end value of the range (exclusive)a- the object to be passed to the actionaction- the action to be performed for each value in the range- Throws:
E- if the action throws an exception
-
forEach
public static <T,E extends Exception> void forEach(int startInclusive, int endExclusive, int step, T a, Throwables.IntObjConsumer<? super T, E> action) throws EExecutes the providedactionfor each value in the range defined bystartInclusive,endExclusiveandstep, passing the current index and the provided objectato the action.- Type Parameters:
T- the type of the object passed to the actionE- the type of the exception that the action may throw- Parameters:
startInclusive- the start value of the range (inclusive)endExclusive- the end value of the range (exclusive)step- the increment value for each iteration in the range. It can be positive or negative but not zero.a- the object to be passed to the actionaction- the action to be performed for each value in the range- Throws:
IllegalArgumentException- if the step is zeroE- if the action throws an exception
-
forEach
public static <T,E extends Exception> void forEach(T[] a, Throwables.Consumer<? super T, E> action) throws EExecutes the providedactionfor each element in the given array.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedaction- the action to be performed for each element in the array- Throws:
E- if the action throws an exception
-
forEach
public static <T,E extends Exception> void forEach(T[] a, int fromIndex, int toIndex, Throwables.Consumer<? super T, E> action) throws IndexOutOfBoundsException, EExecutes the providedactionfor each element within the specified range in the given array.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedfromIndex- the start index of the range (inclusive)toIndex- the end index of the range (exclusive)action- the action to be performed for each element within the specified range of the array- Throws:
IndexOutOfBoundsException- if the specified range is out of boundsE- if the action throws an exception
-
forEach
public static <T,E extends Exception> void forEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> action) throws EExecutes the providedactionfor each element in the given iterable.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the action may throw- Parameters:
c- the iterable whose elements are to be processedaction- the action to be performed for each element in the iterable- Throws:
E- if the action throws an exception
-
forEach
public static <T,E extends Exception> void forEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> action) throws EExecutes the providedactionfor each element in the given iterator.- Type Parameters:
T- the type of the elements in the iteratorE- the type of the exception that the action may throw- Parameters:
action- the action to be performed for each element in the iteratorc- the iterator whose elements are to be processed- Throws:
E- if the action throws an exception
-
forEach
public static <T,E extends Exception> void forEach(Collection<? extends T> c, int fromIndex, int toIndex, Throwables.Consumer<? super T, E> action) throws IndexOutOfBoundsException, EExecutes the providedactionfor each element within the specified range in the given collection.- Type Parameters:
T- the type of the elements in the collectionE- the type of the exception that the action may throw- Parameters:
c- the collection whose elements are to be processedfromIndex- the start index of the range (inclusive)toIndex- the end index of the range (exclusive)action- the action to be performed for each element within the specified range of the collection- Throws:
IndexOutOfBoundsException- if the specified range is out of boundsE- if the action throws an exception
-
forEach
public static <K,V, void forEachE extends Exception> (Map<K, V> map, Throwables.Consumer<? super Map.Entry<K, throws EV>, E> action) Executes the providedactionfor each entry in the given map.- Type Parameters:
K- the type of the keys in the mapV- the type of the values in the mapE- the type of the exception that the action may throw- Parameters:
map- the map whose elements are to be processedaction- the action to be performed for each entry in the given map- Throws:
E- if the action throws an exception
-
forEach
public static <K,V, void forEachE extends Exception> (Map<K, V> map, Throwables.BiConsumer<? super K, throws E? super V, E> action) Executes the providedactionfor each entry in the given map.- Type Parameters:
K- the type of the keys in the mapV- the type of the values in the mapE- the type of the exception that the action may throw- Parameters:
map- the map whose elements are to be processedaction- the action to be performed for each entry in the given map- Throws:
E- if the action throws an exception
-
forEach
public static <T,E extends Exception> void forEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum) Executes the providedelementConsumerfor each element in the given iterable by the specified number of threads.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the elementConsumer may throw- Parameters:
c- the iterable whose elements are to be processedelementConsumer- the action to be performed for each element in the iterableprocessThreadNum- the number of threads to use for processing
-
forEach
public static <T,E extends Exception> void forEach(Iterable<? extends T> c, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) Executes the providedelementConsumerfor each element in the given iterable by the specified number of threads and executor.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the elementConsumer may throw- Parameters:
c- the iterable whose elements are to be processedelementConsumer- the action to be performed for each element in the iterableprocessThreadNum- the number of threads to use for processingexecutor- the executor to use for processing
-
forEach
public static <T,E extends Exception> void forEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum) Executes the providedelementConsumerfor each element in the given iterator by the specified number of threads.- Type Parameters:
T- the type of the elements in the iteratorE- the type of the exception that the elementConsumer may throw- Parameters:
iter- the iterator whose elements are to be processedelementConsumer- the action to be performed for each element in the iteratorprocessThreadNum- the number of threads to use for processing
-
forEach
public static <T,E extends Exception> void forEach(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) Executes the providedelementConsumerfor each element in the given iterator by the specified number of threads and executor.- Type Parameters:
T- the type of the elements in the iteratorE- the type of the exception that the elementConsumer may throw- Parameters:
iter- the iterator whose elements are to be processedelementConsumer- the action to be performed for each element in the iteratorprocessThreadNum- the number of threads to use for processingexecutor- the executor to use for processing
-
forEach
public static <T,U, void forEachE extends Exception, E2 extends Exception> (T[] a, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to each element in the given array, and then executes the specifiedactionto each resulting element.- Type Parameters:
T- the type of the elements in the arrayU- the type of the elements produced by the flatMapperE- the type of the exception that the flatMapper may throwE2- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedflatMapper- the function to apply to each element in the given array, producing an iterable of elementsaction- the action to be performed for each pair of elements from the given array and the resulting iterable- Throws:
E- if the flatMapper throws an exceptionE2- if the action throws an exception
-
forEach
public static <T,U, void forEachE extends Exception, E2 extends Exception> (Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to each element in the given iterable, and then executes the specifiedactionto each resulting element.- Type Parameters:
T- the type of the elements in the collectionU- the type of the elements produced by the flatMapperE- the type of the exception that the flatMapper may throwE2- the type of the exception that the action may throw- Parameters:
c- the collection whose elements are to be processedflatMapper- the function to apply to each element in the given iterable, producing an iterable of elementsaction- the action to be performed for each pair of elements from the given iterable and the resulting iterable- Throws:
E- if the flatMapper throws an exceptionE2- if the action throws an exception
-
forEach
public static <T,U, void forEachE extends Exception, E2 extends Exception> (Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to each element in the given iterator, and then executes the specifiedactionto each resulting element.- Type Parameters:
T- the type of the elements in the iteratorU- the type of the elements produced by the flatMapperE- the type of the exception that the flatMapper may throwE2- the type of the exception that the action may throw- Parameters:
iter- the iterator whose elements are to be processedflatMapper- the function to apply to each element in the given iterator, producing an iterable of elementsaction- the action to be performed each pair of elements from the given iterator and the resulting iterable- Throws:
E- if the flatMapper throws an exceptionE2- if the action throws an exception
-
forEach
public static <T,T2, void forEachT3, E extends Exception, E2 extends Exception, E3 extends Exception> (T[] a, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor each element in the given array after applying theflatMapperandflatMapper2functions. TheflatMapperfunction maps each element of typeTto anIterableof elements of typeT2. TheflatMapper2function maps each element of typeT2to anIterableof elements of typeT3. Theactionis then performed for each triple of elements from the original array and the resulting iterables.- Type Parameters:
T- the type of the elements in the arrayT2- the type of the elements in the iterable returned by the flatMapperT3- the type of the elements in the iterable returned by the flatMapper2E- the type of the exception that the flatMapper may throwE2- the type of the exception that the flatMapper2 may throwE3- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedflatMapper- the function to apply to each element in given the array to produce an iterable of elements of type T2flatMapper2- the function to apply to each element in the iterable of type T2 to produce an iterable of elements of type T3action- the action to be performed for each triple of elements from the given array and the resulting iterables- Throws:
E- if the flatMapper throws an exceptionE2- if the flatMapper2 throws an exceptionE3- if the action throws an exception
-
forEach
public static <T,T2, void forEachT3, E extends Exception, E2 extends Exception, E3 extends Exception> (Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor each element in the given iterable after applying theflatMapperandflatMapper2functions. TheflatMapperfunction maps each element of typeTto anIterableof elements of typeT2. TheflatMapper2function maps each element of typeT2to anIterableof elements of typeT3. Theactionis then performed for each triple of elements from the original iterable and the resulting iterables.- Type Parameters:
T- the type of the elements in the collectionT2- the type of the elements in the iterable returned by the flatMapperT3- the type of the elements in the iterable returned by the flatMapper2E- the type of the exception that the flatMapper may throwE2- the type of the exception that the flatMapper2 may throwE3- the type of the exception that the action may throw- Parameters:
c- the collection whose elements are to be processedflatMapper- the function to apply to each element in the given iterable to produce an iterable of elements of type T2flatMapper2- the function to apply to each element in the iterable of type T2 to produce an iterable of elements of type T3action- the action to be performed for each triple of elements from the given iterable and the resulting iterables- Throws:
E- if the flatMapper throws an exceptionE2- if the flatMapper2 throws an exceptionE3- if the action throws an exception
-
forEach
public static <T,T2, void forEachT3, E extends Exception, E2 extends Exception, E3 extends Exception> (Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor each element in the given iterator after applying theflatMapperandflatMapper2functions. TheflatMapperfunction maps each element of typeTto anIterableof elements of typeT2. TheflatMapper2function maps each element of typeT2to anIterableof elements of typeT3. Theactionis then performed for each triple of elements from the original iterator and the resulting iterables.- Type Parameters:
T- the type of the elements in the iteratorT2- the type of the elements in the iterable returned by the flatMapperT3- the type of the elements in the iterable returned by the flatMapper2E- the type of the exception that the flatMapper may throwE2- the type of the exception that the flatMapper2 may throwE3- the type of the exception that the action may throw- Parameters:
iter- the iterator whose elements are to be processedflatMapper- the function to apply to each element in the given iterator to produce an iterable of elements of type T2flatMapper2- the function to apply to each element in the iterable of type T2 to produce an iterable of elements of type T3action- the action to be performed for each triple of elements from the given iterator and the resulting iterables- Throws:
E- if the flatMapper throws an exceptionE2- if the flatMapper2 throws an exceptionE3- if the action throws an exception
-
forEach
public static <A,B, void forEachE extends Exception> (A[] a, B[] b, Throwables.BiConsumer<? super A, ? super B, throws EE> action) Executes the providedactionfor each pair of elements from the given arrays until all elements from the shorter array are processed.- Type Parameters:
A- the type of the elements in the first arrayB- the type of the elements in the second arrayE- the type of the exception that the action may throw- Parameters:
a- the first array whose elements are to be processedb- the second array whose elements are to be processedaction- the action to be performed for each pair of elements from the arrays- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachE extends Exception> (Iterable<A> a, Iterable<B> b, Throwables.BiConsumer<? super A, ? super B, throws EE> action) Executes the providedactionfor each pair of elements from the given iterables until all elements from the shorter iterable are processed.- Type Parameters:
A- the type of the elements in the first iterableB- the type of the elements in the second iterableE- the type of the exception that the action may throw- Parameters:
a- the first iterable whose elements are to be processedb- the second iterable whose elements are to be processedaction- the action to be performed for each pair of elements from the iterables- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachE extends Exception> (Iterator<A> a, Iterator<B> b, Throwables.BiConsumer<? super A, ? super B, throws EE> action) Executes the providedactionfor each pair of elements from the given iterators until all elements from the shorter iterator are processed.- Type Parameters:
A- the type of the elements in the first iteratorB- the type of the elements in the second iteratorE- the type of the exception that the action may throw- Parameters:
a- the first iterator whose elements are to be processedb- the second iterator whose elements are to be processedaction- the action to be performed for each pair of elements from the iterators- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachC, E extends Exception> (A[] a, B[] b, C[] c, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) Executes the providedactionfor each triple of elements from the given arrays until all elements from the shortest array are processed.- Type Parameters:
A- the type of the elements in the first arrayB- the type of the elements in the second arrayE- the type of the exception that the action may throwB- the type of the elements in the third array- Parameters:
a- the first array whose elements are to be processedb- the second array whose elements are to be processedc- the third array whose elements are to be processedaction- the action to be performed for each triple of elements from the arrays- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachC, E extends Exception> (Iterable<A> a, Iterable<B> b, Iterable<C> c, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) Executes the providedactionfor each triple of elements from the given iterables until all elements from the shortest iterable are processed.- Type Parameters:
A- the type of the elements in the first iterableB- the type of the elements in the second iterableC- the type of the elements in the third iterableE- the type of the exception that the action may throw- Parameters:
a- the first iterable whose elements are to be processedb- the second iterable whose elements are to be processedc- the third iterable whose elements are to be processedaction- the action to be performed for each triple of elements from the iterables- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachC, E extends Exception> (Iterator<A> a, Iterator<B> b, Iterator<C> c, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) Executes the providedactionfor each triple of elements from the given iterators until all elements from the shortest iterator are processed.- Type Parameters:
A- the type of the elements in the first iteratorB- the type of the elements in the second iteratorC- the type of the elements in the third iteratorE- the type of the exception that the action may throw- Parameters:
a- the first iterator whose elements are to be processedb- the second iterator whose elements are to be processedc- the third iterator whose elements are to be processedaction- the action to be performed for each triple of elements from the iterators- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachE extends Exception> (A[] a, B[] b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, throws EE> action) Executes the providedactionfor each pair of elements from the given arrays until all elements from the longer array are processed.- Type Parameters:
A- the type of the elements in the first arrayB- the type of the elements in the second arrayE- the type of the exception that the action may throw- Parameters:
a- the first array whose elements are to be processedb- the second array whose elements are to be processedvalueForNoneA- the value to be used if the first array is shorter than the second arrayvalueForNoneB- the value to be used if the second array is shorter than the first arrayaction- the action to be performed for each pair of elements from the arrays- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachE extends Exception> (Iterable<A> a, Iterable<B> b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, throws EE> action) Executes the providedactionfor each pair of elements from the given iterables until all elements from the longer iterable are processed.- Type Parameters:
A- the type of the elements in the first iterableB- the type of the elements in the second iterableE- the type of the exception that the action may throw- Parameters:
a- the first iterable whose elements are to be processedb- the second iterable whose elements are to be processedvalueForNoneA- the value to be used if the first iterable is shorter than the second iterablevalueForNoneB- the value to be used if the second iterable is shorter than the first iterableaction- the action to be performed for each pair of elements from the iterables- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachE extends Exception> (Iterator<A> a, Iterator<B> b, A valueForNoneA, B valueForNoneB, Throwables.BiConsumer<? super A, ? super B, throws EE> action) Executes the providedactionfor each pair of elements from the given iterators until all elements from the longer iterator are processed.- Type Parameters:
A- the type of the elements in the first iteratorB- the type of the elements in the second iteratorE- the type of the exception that the action may throw- Parameters:
a- the first iterator whose elements are to be processedb- the second iterator whose elements are to be processedvalueForNoneA- the value to be used if the first iterator is shorter than the second iteratorvalueForNoneB- the value to be used if the second iterator is shorter than the first iteratoraction- the action to be performed for each pair of elements from the iterators- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachC, E extends Exception> (A[] a, B[] b, C[] c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) Executes the providedactionfor each triple of elements from the given arrays until all elements from the longest array are processed.- Type Parameters:
A- the type of the elements in the first arrayB- the type of the elements in the second arrayC- the type of the elements in the third arrayE- the type of the exception that the action may throw- Parameters:
a- the first array whose elements are to be processedb- the second array whose elements are to be processedc- the third array whose elements are to be processedvalueForNoneA- the value to be used if the first array is shorter than the second and third arraysvalueForNoneB- the value to be used if the second array is shorter than the first and third arraysvalueForNoneC- the value to be used if the third array is shorter than the first and second arraysaction- the action to be performed for each triple of elements from the arrays- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachC, E extends Exception> (Iterable<A> a, Iterable<B> b, Iterable<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) Executes the providedactionfor each triple of elements from the given iterables until all elements from the longest iterable are processed.- Type Parameters:
A- the type of the elements in the first iterableB- the type of the elements in the second iterableC- the type of the elements in the third iterableE- the type of the exception that the action may throw- Parameters:
a- the first iterable whose elements are to be processedb- the second iterable whose elements are to be processedc- the third iterable whose elements are to be processedvalueForNoneA- the value to be used if the first iterable is shorter than the second and third iterablesvalueForNoneB- the value to be used if the second iterable is shorter than the first and third iterablesvalueForNoneC- the value to be used if the third iterable is shorter than the first and second iterablesaction- the action to be performed for each triple of elements from the iterables- Throws:
E- if the action throws an exception
-
forEach
public static <A,B, void forEachC, E extends Exception> (Iterator<A> a, Iterator<B> b, Iterator<C> c, A valueForNoneA, B valueForNoneB, C valueForNoneC, Throwables.TriConsumer<? super A, ? super B, throws E? super C, E> action) Executes the providedactionfor each triple of elements from the given iterators until all elements from the longest iterator are processed.- Type Parameters:
A- the type of the elements in the first iteratorB- the type of the elements in the second iteratorC- the type of the elements in the third iteratorE- the type of the exception that the action may throw- Parameters:
a- the first iterator whose elements are to be processedb- the second iterator whose elements are to be processedc- the third iterator whose elements are to be processedvalueForNoneA- the value to be used if the first iterator is shorter than the second and third iteratorsvalueForNoneB- the value to be used if the second iterator is shorter than the first and third iteratorsvalueForNoneC- the value to be used if the third iterator is shorter than the first and second iteratorsaction- the action to be performed for each triple of elements from the iterators- Throws:
E- if the action throws an exception
-
forEachNonNull
public static <T,E extends Exception> void forEachNonNull(T[] a, Throwables.Consumer<? super T, E> action) throws EExecutes the providedactionfor eachnon-nullelement in the given array. Thenullelements are ignored.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whosenon-nullelements are to be processedaction- the action to be performed for eachnon-nullelement in the array- Throws:
E- if the action throws an exception
-
forEachNonNull
public static <T,E extends Exception> void forEachNonNull(Iterable<? extends T> c, Throwables.Consumer<? super T, E> action) throws EExecutes the providedactionfor eachnon-nullelement in the given iterable. Thenullelements are ignored.- Type Parameters:
T- the type of the elements in the collectionE- the type of the exception that the action may throw- Parameters:
c- the collection whosenon-nullelements are to be processedaction- the action to be performed for eachnon-nullelement in the collection- Throws:
E- if the action throws an exception
-
forEachNonNull
public static <T,E extends Exception> void forEachNonNull(Iterator<? extends T> iter, Throwables.Consumer<? super T, E> action) throws EExecutes the providedactionfor eachnon-nullelement in the given iterator. Thenullelements are ignored.- Type Parameters:
T- the type of the elements in the iteratorE- the type of the exception that the action may throw- Parameters:
iter- the iterator whosenon-nullelements are to be processedaction- the action to be performed for eachnon-nullelement in the iterator- Throws:
E- if the action throws an exception
-
forEachNonNull
public static <T,U, void forEachNonNullE extends Exception, E2 extends Exception> (T[] a, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to eachnon-nullelement in the given array, and then executes the specifiedactionto eachnon-nullresulting element.- Type Parameters:
T- the type of the elements in the given arrayU- the type of the elements produced by the flatMapperE- the type of the exception that the flatMapper may throwE2- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedflatMapper- the function to apply to eachnon-nullelement in the given array, producing an iterable of elementsaction- the action to be performed for each pair ofnon-nullelements from the given array and the resulting iterable- Throws:
E- if the flatMapper throws an exceptionE2- if the action throws an exception
-
forEachNonNull
public static <T,U, void forEachNonNullE extends Exception, E2 extends Exception> (Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to eachnon-nullelement in the given iterable, and then executes the specifiedactionto eachnon-nullresulting element.- Type Parameters:
T- the type of the elements in the given iterableU- the type of the elements produced by the flatMapperE- the type of the exception that the flatMapper may throwE2- the type of the exception that the action may throw- Parameters:
c- the collection whose elements are to be processedflatMapper- the function to apply to eachnon-nullelement in the given iterable, producing an iterable of elementsaction- the action to be performed for pair ofnon-nullelements from the given iterable and the resulting iterable- Throws:
E- if the flatMapper throws an exceptionE2- if the action throws an exception
-
forEachNonNull
public static <T,U, void forEachNonNullE extends Exception, E2 extends Exception> (Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<U>, throws E, E2E> flatMapper, Throwables.BiConsumer<? super T, ? super U, E2> action) Applies the providedflatMapperfunction to eachnon-nullelement in the given iterator, and then executes the specifiedactionto eachnon-nullresulting element.- Type Parameters:
T- the type of the elements in the given iteratorU- the type of the elements produced by the flatMapperE- the type of the exception that the flatMapper may throwE2- the type of the exception that the action may throw- Parameters:
iter- the iterator whose elements are to be processedflatMapper- the function to apply to eachnon-nullelement in the given iterator, producing an iterable of elementsaction- the action to be performed for pair ofnon-nullelements from the given iterator and the resulting iterable- Throws:
E- if the flatMapper throws an exceptionE2- if the action throws an exception
-
forEachNonNull
public static <T,T2, void forEachNonNullT3, E extends Exception, E2 extends Exception, E3 extends Exception> (T[] a, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor eachnon-nullelement in the given array after applying theflatMapperandflatMapper2functions. TheflatMapperfunction maps eachnon-nullelement of typeTto anIterableof elements of typeT2. TheflatMapper2function maps eachnon-nullelement of typeT2to anIterableof elements of typeT3. Theactionis then performed for each triple ofnon-nullelements from the original array and the resulting iterables.- Type Parameters:
T- the type of the elements in the given arrayT2- the type of the elements in the iterable returned by the flatMapperT3- the type of the elements in the iterable returned by the flatMapper2E- the type of the exception that the flatMapper may throwE2- the type of the exception that the flatMapper2 may throwE3- the type of the exception that the action may throw- Parameters:
a- the array whosenon-nullelements are to be processedflatMapper- the function to apply to eachnon-nullelement in the given array to produce an iterable of elements of type T2flatMapper2- the function to apply to eachnon-nullelement in the iterable of type T2 to produce an iterable of elements of type T3action- the action to be performed for each triple ofnon-nullelements from the given array and the resulting iterables- Throws:
E- if the flatMapper throws an exceptionE2- if the flatMapper2 throws an exceptionE3- if the action throws an exception
-
forEachNonNull
public static <T,T2, void forEachNonNullT3, E extends Exception, E2 extends Exception, E3 extends Exception> (Iterable<? extends T> c, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor eachnon-nullelement in the given iterable after applying theflatMapperandflatMapper2functions. TheflatMapperfunction maps eachnon-nullelement of typeTto anIterableof elements of typeT2. TheflatMapper2function maps eachnon-nullelement of typeT2to anIterableof elements of typeT3. Theactionis then performed for each triple ofnon-nullelements from the original iterable and the resulting iterables.- Type Parameters:
T- the type of the elements in the given iterableT2- the type of the elements in the iterable returned by the flatMapperT3- the type of the elements in the iterable returned by the flatMapper2E- the type of the exception that the flatMapper may throwE2- the type of the exception that the flatMapper2 may throwE3- the type of the exception that the action may throw- Parameters:
c- the iterable whosenon-nullelements are to be processedflatMapper- the function to apply to eachnon-nullelement in the given iterable to produce an iterable of elements of type T2flatMapper2- the function to apply to eachnon-nullelement in the given iterable of type T2 to produce an iterable of elements of type T3action- the action to be performed for each triple ofnon-nullelements from the given iterable and the resulting iterables- Throws:
E- if the flatMapper throws an exceptionE2- if the flatMapper2 throws an exceptionE3- if the action throws an exception
-
forEachNonNull
public static <T,T2, void forEachNonNullT3, E extends Exception, E2 extends Exception, E3 extends Exception> (Iterator<? extends T> iter, Throwables.Function<? super T, ? extends Iterable<T2>, throws E, E2, E3E> flatMapper, Throwables.Function<? super T2, ? extends Iterable<T3>, E2> flatMapper2, Throwables.TriConsumer<? super T, ? super T2, ? super T3, E3> action) Executes the providedactionfor eachnon-nullelement in the given iterator after applying theflatMapperandflatMapper2functions. TheflatMapperfunction maps eachnon-nullelement of typeTto anIterableof elements of typeT2. TheflatMapper2function maps eachnon-nullelement of typeT2to anIterableof elements of typeT3. Theactionis then performed for each triple ofnon-nullelements from the original iterator and the resulting iterables.- Type Parameters:
T- the type of the elements in the given iteratorT2- the type of the elements produced by the flatMapperT3- the type of the elements produced by the flatMapper2E- the type of the exception that the flatMapper may throwE2- the type of the exception that the flatMapper2 may throwE3- the type of the exception that the action may throw- Parameters:
iter- the iterator whosenon-nullelements are to be processedflatMapper- the function to apply to eachnon-nullelement in the given iterator to produce an iterable of elements of type T2flatMapper2- the function to apply to eachnon-nullelement in the iterable of type T2 to produce an iterable of elements of type T3action- the action to be performed for each triple ofnon-nullelements from the given iterator and the resulting iterables- Throws:
E- if the flatMapper throws an exceptionE2- if the flatMapper2 throws an exceptionE3- if the action throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(T[] a, Throwables.IntObjConsumer<? super T, E> action) throws EExecutes the providedactionfor each element in the given array, passing the index and the element to the action.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedaction- the action to be performed for each element, which takes the index and the element as parameters- Throws:
E- if the action throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(T[] a, int fromIndex, int toIndex, Throwables.IntObjConsumer<? super T, E> action) throws IndexOutOfBoundsException, EExecutes the providedactionfor each element within the specified range in the given array, passing the index and the element to the action. IffromIndexis greater thantoIndex, the elements are processed from back to front.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedfromIndex- the starting index (inclusive) of the range to be processedtoIndex- the ending index (exclusive) of the range to be processedaction- the action to be performed for each element within the specified range, which takes the index and the element as parameters- Throws:
IndexOutOfBoundsException- if the specified range is out of boundsE- if the action throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Collection<? extends T> c, int fromIndex, int toIndex, Throwables.IntObjConsumer<? super T, E> action) throws IndexOutOfBoundsException, EExecutes the providedactionfor each element within the specified range in the given collection, passing the index and the element to the action. IffromIndexis greater thantoIndex, the elements are processed from back to front.- Type Parameters:
T- the type of the elements in the collectionE- the type of the exception that the action may throw- Parameters:
c- the collection whose elements are to be processedfromIndex- the starting index (inclusive) of the range to be processedtoIndex- the ending index (exclusive) of the range to be processedaction- the action to be performed for each element within the specified range, which takes the index and the element as parameters- Throws:
IndexOutOfBoundsException- if the specified range is out of boundsE- if the action throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> action) throws EExecutes the providedactionfor each element in the given iterable, passing the index and the element to the action.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the action may throw- Parameters:
c- the collection whose elements are to be processedaction- the action to be performed for each element, which takes the index and the element as parameters- Throws:
E- if the action throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> action) throws EExecutes the providedactionfor each element in the given iterable, passing the index and the element to the action.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the action may throw- Parameters:
action- the action to be performed for each element, which takes the index and the element as parametersc- the collection whose elements are to be processed- Throws:
E- if the action throws an exception
-
forEachIndexed
public static <K,V, void forEachIndexedE extends Exception> (Map<K, V> map, Throwables.IntObjConsumer<? super Map.Entry<K, throws EV>, E> action) Executes the providedactionfor each entry in the given map, passing the index and the entry to the action.- Type Parameters:
K- the type of the keys in the mapV- the type of the values in the mapE- the type of the exception that the action may throw- Parameters:
map- the map whose entries are to be processedaction- the action to be performed for each entry, which takes the index and the entry as parameters- Throws:
E- if the action throws an exception
-
forEachIndexed
public static <K,V, void forEachIndexedE extends Exception> (Map<K, V> map, Throwables.IntBiObjConsumer<? super K, throws E? super V, E> action) Executes the providedactionfor each entry in the given map, passing the index, the key, and the value to the action.- Type Parameters:
K- the type of the keys in the mapV- the type of the values in the mapE- the type of the exception that the action may throw- Parameters:
map- the map whose entries are to be processedaction- the action to be performed for each entry, which takes the index, the key, and the value as parameters- Throws:
E- if the action throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> action, int processThreadNum) Executes the providedactionfor each element in the givenIterable, passing the index and the element to the action, by the specified number of threads.- Type Parameters:
T- the type of the elements in theIterableE- the type of the exception that the consumer may throw- Parameters:
c- theIterablewhose elements are to be processedaction- the consumer to be performed for each element, which takes the index and the element as parametersprocessThreadNum- the number of threads to use for processing- Throws:
E- if the consumer throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterable<? extends T> c, Throwables.IntObjConsumer<? super T, E> action, int processThreadNum, Executor executor) Executes the providedactionfor each element in the givenIterable, passing the index and the element to the action, by the specified number of threads and executor.- Type Parameters:
T- the type of the elements in theIterableE- the type of the exception that the consumer may throw- Parameters:
c- theIterablewhose elements are to be processedaction- the consumer to be performed for each element, which takes the index and the element as parametersprocessThreadNum- the number of threads to use for processingexecutor- the executor to use for processing- Throws:
E- if the consumer throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum) Executes the providedactionfor each element in the givenIterator, passing the index and the element to the action, by the specified number of threads.- Type Parameters:
T- the type of the elements in theIteratorE- the type of the exception that the consumer may throw- Parameters:
iter- theIteratorwhose elements are to be processedprocessThreadNum- the number of threads to use for processingaction- the consumer to be performed for each element, which takes the index and the element as parameters- Throws:
E- if the consumer throws an exception
-
forEachIndexed
public static <T,E extends Exception> void forEachIndexed(Iterator<? extends T> iter, Throwables.IntObjConsumer<? super T, E> elementConsumer, int processThreadNum, Executor executor) throws IllegalArgumentExceptionExecutes the providedactionfor each element in the givenIterator, passing the index and the element to the action, by the specified number of threads and executor.- Type Parameters:
T- the type of the elements in theIteratorE- the type of the exception that the consumer may throw- Parameters:
iter- theIteratorwhose elements are to be processedprocessThreadNum- the number of threads to use for processingexecutor- the executor to use for processingaction- the consumer to be performed for each element, which takes the index and the element as parameters- Throws:
E- if the consumer throws an exceptionIllegalArgumentException
-
forEachPair
public static <T,E extends Exception> void forEachPair(T[] a, Throwables.BiConsumer<? super T, ? super T, throws EE> action) Executes the providedactionfor each pair of consecutive elements in the given array. For the last non-paired element, the action is performed with the last element andnull.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedaction- the action to be performed for each pair of elements- Throws:
E- if the action throws an exception
-
forEachPair
public static <T,E extends Exception> void forEachPair(T[] a, int increment, Throwables.BiConsumer<? super T, ? super T, throws EE> action) Executes the providedactionfor each pair of consecutive elements in the given array, with the specified increment between pairs. For the last non-paired element, the action is performed with the last element andnull.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedincrement- the increment between pairs of elementsaction- the action to be performed for each pair of elements- Throws:
E- if the action throws an exception
-
forEachPair
public static <T,E extends Exception> void forEachPair(Iterable<? extends T> c, Throwables.BiConsumer<? super T, ? super T, throws EE> action) Executes the providedactionfor each pair of consecutive elements in the given iterable. For the last non-paired element, the action is performed with the last element andnull.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the action may throw- Parameters:
c- the iterable whose elements are to be processedaction- the action to be performed for each pair of elements- Throws:
E- if the action throws an exception
-
forEachPair
public static <T,E extends Exception> void forEachPair(Iterable<? extends T> c, int increment, Throwables.BiConsumer<? super T, ? super T, throws EE> action) Executes the providedactionfor each pair of consecutive elements in the given iterable, with the specified increment between pairs. For the last non-paired element, the action is performed with the last element andnull.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the action may throw- Parameters:
c- the iterable whose elements are to be processedincrement- the increment between pairs of elementsaction- the action to be performed for each pair of elements- Throws:
E- if the action throws an exception
-
forEachPair
public static <T,E extends Exception> void forEachPair(Iterator<? extends T> iter, Throwables.BiConsumer<? super T, ? super T, throws EE> action) Executes the providedactionfor each pair of consecutive elements in the given iterator. For the last non-paired element, the action is performed with the last element andnull.- Type Parameters:
T- the type of the elements in the iteratorE- the type of the exception that the action may throw- Parameters:
iter- the iterator whose elements are to be processedaction- the action to be performed for each pair of elements- Throws:
E- if the action throws an exception
-
forEachPair
public static <T,E extends Exception> void forEachPair(Iterator<? extends T> iter, int increment, Throwables.BiConsumer<? super T, ? super T, throws EE> action) Executes the providedactionfor each pair of consecutive elements in the given iterator, with the specified increment between pairs. For the last non-paired element, the action is performed with the last element andnull.- Type Parameters:
T- the type of the elements in the iteratorE- the type of the exception that the action may throw- Parameters:
iter- the iterator whose elements are to be processedincrement- the increment between pairs of elementsaction- the action to be performed for each pair of elements- Throws:
E- if the action throws an exception
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(T[] a, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given array. For the last two non-tripled elements, the action is performed with the last two elements andnull.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedaction- the action to be performed for each triple of elements- Throws:
E- if the action throws an exception
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(T[] a, int increment, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given array, with the specified increment between triples. For the last two non-tripled elements, the action is performed with the last two elements andnull.- Type Parameters:
T- the type of the elements in the arrayE- the type of the exception that the action may throw- Parameters:
a- the array whose elements are to be processedincrement- the increment between triples of elementsaction- the action to be performed for each triple of elements- Throws:
E- if the action throws an exception
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(Iterable<? extends T> c, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given iterable. For the last two non-tripled elements, the action is performed with the last two elements andnull.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the action may throw- Parameters:
c- the iterable whose elements are to be processedaction- the action to be performed for each triple of elements- Throws:
E- if the action throws an exception
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(Iterable<? extends T> c, int increment, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given iterable, with the specified increment between triples. For the last two non-tripled elements, the action is performed with the last two elements andnull.- Type Parameters:
T- the type of the elements in the iterableE- the type of the exception that the action may throw- Parameters:
c- the iterable whose elements are to be processedincrement- the increment between triples of elementsaction- the action to be performed for each triple of elements- Throws:
E- if the action throws an exception
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(Iterator<? extends T> iter, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given iterator. For the last two non-tripled elements, the action is performed with the last two elements andnull.- Type Parameters:
T- the type of the elements in the iteratorE- the type of the exception that the action may throw- Parameters:
iter- the iterator whose elements are to be processedaction- the action to be performed for each triple of elements- Throws:
E- if the action throws an exception
-
forEachTriple
public static <T,E extends Exception> void forEachTriple(Iterator<? extends T> iter, int increment, Throwables.TriConsumer<? super T, ? super T, throws E? super T, E> action) Executes the providedactionfor each triple of consecutive elements in the given iterator, with the specified increment between triples. For the last two non-tripled elements, the action is performed with the last two elements andnull.- Type Parameters:
T- the type of the elements in the iteratorE- the type of the exception that the action may throw- Parameters:
iter- the iterator whose elements are to be processedincrement- the increment between triples of elementsaction- the action to be performed for each triple of elements- Throws:
E- if the action throws an exception
-
execute
public static void execute(Throwables.Runnable<? extends Exception> cmd, int retryTimes, long retryIntervallInMillis, Predicate<? super Exception> retryCondition) Executes the provided command with the specified retry logic in case of failure.- Parameters:
cmd- the command to be executedretryTimes- the number of times to retry the command if it failsretryIntervallInMillis- the interval in milliseconds between retriesretryCondition- The condition to be checked after each execution failure to decide whether to retry or not- Throws:
RuntimeException- if the command execution fails and no more retries are allowed.- See Also:
-
execute
public static <R> R execute(Callable<R> cmd, int retryTimes, long retryIntervallInMillis, BiPredicate<? super R, ? super Exception> retryCondition) Executes the provided command with the specified retry logic in case of failure.- Parameters:
cmd- the command to be executedretryTimes- the number of times to retry the command if it failsretryIntervallInMillis- the interval in milliseconds between retriesretryCondition- The condition to be checked after each execution failure to decide whether to retry or not- Returns:
- The result returned by the Callable task.
- Throws:
RuntimeException- if the command execution fails and no more retries are allowed.- See Also:
-
asyncExecute
public static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command) Executes the provided command asynchronously.- Parameters:
command- the command to be executed- Returns:
- a ContinuableFuture representing the pending completion of the task
- See Also:
-
asyncExecute
public static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command, Executor executor) Executes the provided command asynchronously by the specified executor.- Parameters:
command- the command to be executedexecutor- the executor to use for processing- Returns:
- a ContinuableFuture representing the pending completion of the task
- See Also:
-
asyncExecute
public static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> command, long delayInMillis) Executes the provided command asynchronously with the specified delay.- Parameters:
command- the command to be executeddelayInMillis- The delay before the command is executed, in milliseconds.- Returns:
- a ContinuableFuture representing the pending completion of the task
- See Also:
-
asyncExecute
Executes the provided command asynchronously.- Parameters:
command- the command to be executed- Returns:
- a ContinuableFuture representing the pending completion of the task
- See Also:
-
asyncExecute
Executes the provided command asynchronously by the specified executor.- Parameters:
command- the command to be executedexecutor- the executor to use for processing- Returns:
- a ContinuableFuture representing the pending completion of the task
- See Also:
-
asyncExecute
Executes the provided command asynchronously with the specified delay.- Parameters:
command- the command to be executeddelayInMillis- The delay before the command is executed, in milliseconds.- Returns:
- a ContinuableFuture representing the pending completion of the task
- See Also:
-
asyncExecute
public static ContinuableFuture<Void> asyncExecute(Throwables.Runnable<? extends Exception> cmd, int retryTimes, long retryIntervallInMillisInMillis, Predicate<? super Exception> retryCondition) Executes the provided command asynchronously with the specified retry logic in case of failure.- Parameters:
cmd- the command to be executedretryTimes- the number of times to retry the command if it failsretryCondition- The condition to be checked after each execution failure to decide whether to retry or notretryIntervallInMillis- the interval in milliseconds between retries- See Also:
-
asyncExecute
public static <R> ContinuableFuture<R> asyncExecute(Callable<R> cmd, int retryTimes, long retryIntervallInMillisInMillis, BiPredicate<? super R, ? super Exception> retryCondition) Executes the provided command asynchronously with the specified retry logic in case of failure.- Parameters:
cmd- the command to be executedretryTimes- the number of times to retry the command if it failsretryCondition- The condition to be checked after each execution failure to decide whether to retry or notretryIntervallInMillis- the interval in milliseconds between retries- See Also:
-
asyncExecute
public static List<ContinuableFuture<Void>> asyncExecute(List<? extends Throwables.Runnable<? extends Exception>> commands) Executes the provided a list of commands asynchronously.- Parameters:
commands- the list of commands to be executed- Returns:
- a list of ContinuableFuture objects representing the pending completion of each command
- See Also:
-
asyncExecute
public static List<ContinuableFuture<Void>> asyncExecute(List<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) Executes the provided a list of commands asynchronously by the specified executor.- Parameters:
commands- the list of commands to be executedexecutor- the executor to use for processing- Returns:
- a list of ContinuableFuture objects representing the pending completion of each command
- See Also:
-
asyncExecute
public static <R> List<ContinuableFuture<R>> asyncExecute(Collection<? extends Callable<R>> commands) Executes the provided a collection of commands asynchronously.- Parameters:
commands- the collection of commands to be executed- Returns:
- a list of ContinuableFuture objects representing the pending completion of each command
- See Also:
-
asyncExecute
public static <R> List<ContinuableFuture<R>> asyncExecute(Collection<? extends Callable<R>> commands, Executor executor) Executes the provided a collection of commands asynchronously by the specified executor.- Parameters:
commands- the collection of commands to be executedexecutor- the executor to use for processing- Returns:
- a list of ContinuableFuture objects representing the pending completion of each command
- See Also:
-
asynRun
public static ObjIterator<Void> asynRun(Collection<? extends Throwables.Runnable<? extends Exception>> commands) Executes the specified commands/tasks asynchronously and immediately returns an iterator for iterating the result lazily. The first element will be the result of the command/task which is completed first.
If an error occurs in one command/task, iteration will be interrupted and the error will be thrown. However, other commands/tasks won't be impacted or cancelled.- Parameters:
commands- the collection of commands/tasks to be executed- Returns:
- an iterator for iterating the results of the commands/tasks
- See Also:
-
asynRun
public static ObjIterator<Void> asynRun(Collection<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) Executes the specified commands/tasks asynchronously by the specified executor and immediately returns an iterator for iterating the result lazily. The first element will be the result of the command/task which is completed first.
If an error occurs in one command/task, iteration will be interrupted and the error will be thrown. However, other commands/tasks won't be impacted or cancelled.- Parameters:
commands- the collection of commands/tasks to be executedexecutor- the executor to use for processing- Returns:
- an iterator for iterating the results of the commands/tasks
- See Also:
-
asynCall
Executes the specified commands/tasks asynchronously and immediately returns an iterator for iterating the result lazily. The first element will be the result of the command/task which is completed first.
If an error occurs in one command/task, iteration will be interrupted and the error will be thrown. However, other commands/tasks won't be impacted or cancelled.- Parameters:
commands- the collection of commands/tasks to be executed- Returns:
- an iterator for iterating the results of the commands/tasks
- See Also:
-
asynCall
public static <R> ObjIterator<R> asynCall(Collection<? extends Callable<? extends R>> commands, Executor executor) throws IllegalArgumentException Executes the specified commands/tasks asynchronously by the specified executor and immediately returns an iterator for iterating the result lazily. The first element will be the result of the command/task which is completed first.
If an error occurs in one command/task, iteration will be interrupted and the error will be thrown. However, other commands/tasks won't be impacted or cancelled.- Parameters:
commands- the collection of commands/tasks to be executedexecutor- the executor to use for processing- Returns:
- an iterator for iterating the results of the commands/tasks
- Throws:
IllegalArgumentException- See Also:
-
runInParallel
public static void runInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2) Executes and completes the input commands in parallel.
If an error occurs in one task,cancel()will be called for other unfinished tasks.- Parameters:
command- the first command to be executed in current thread.command2- the second command to be executed in another thread.- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
runInParallel
public static void runInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3) Executes and complete the input commands in parallel.
if error happens in one task,cancelwill be called for other unfinished tasks.- Parameters:
command- the first command to be executed in current thread.command2- the second command to be executed in another thread.command3- the third command to be executed in another thread.- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
runInParallel
public static void runInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3, Throwables.Runnable<? extends Exception> command4) Executes and complete the input commands in parallel.
if error happens in one task,cancelwill be called for other unfinished tasks.- Parameters:
command- the first command to be executed in current thread.command2- the second command to be executed in another thread.command3- the third command to be executed in another thread.command4- the fourth command to be executed in another thread.- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
runInParallel
public static void runInParallel(Throwables.Runnable<? extends Exception> command, Throwables.Runnable<? extends Exception> command2, Throwables.Runnable<? extends Exception> command3, Throwables.Runnable<? extends Exception> command4, Throwables.Runnable<? extends Exception> command5) Executes and complete the input commands in parallel.
if error happens in one task,cancelwill be called for other unfinished tasks.- Parameters:
command- the first command to be executed in current thread.command2- the second command to be executed in another thread.command3- the third command to be executed in another thread.command4- the fourth command to be executed in another thread.command5- the fifth command to be executed in another thread.- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
runInParallel
public static void runInParallel(Collection<? extends Throwables.Runnable<? extends Exception>> commands) Executes the specified collection of commands/tasks in parallel.
If an error occurs in one task,cancelwill be called for other unfinished tasks.- Parameters:
commands- the collection of commands/tasks to be executed asynchronously, except the first one which is executed in current thread.- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
runInParallel
public static void runInParallel(Collection<? extends Throwables.Runnable<? extends Exception>> commands, Executor executor) Executes and complete the input commands in parallel.
if error happens in one task,cancelwill be called for other unfinished tasks.- Parameters:
commands- the collection of commands/tasks to be executed asynchronously by the specified execute, except the first one which is executed in current thread.executor- the executor to use for processing- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
callInParallel
Executes and completes the input commands in parallel.
If an error occurs in one task,cancel()will be called for other unfinished tasks.- Type Parameters:
R- the returned type of the first commandR2- the returned type of the second command- Parameters:
command- the first command to be executed in current thread.command2- the second command to be executed in another thread.- Returns:
- a tuple containing the results of the two commands
- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
callInParallel
public static <R,R2, Tuple.Tuple3<R,R3> R2, callInParallelR3> (Callable<R> command, Callable<R2> command2, Callable<R3> command3) Executes the specified commands in parallel and returns a tuple containing the results.
If an error occurs in one task,cancelwill be called for other unfinished tasks.- Type Parameters:
R- the type of the result of the first commandR2- the type of the result of the second commandR3- the type of the result of the third command- Parameters:
command- the first command to be executed in current thread.command2- the second command to be executed in another thread.command3- the third command to be executed in another thread.- Returns:
- a tuple containing the results of the three commands
- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
callInParallel
public static <R,R2, Tuple.Tuple4<R,R3, R4> R2, callInParallelR3, R4> (Callable<R> command, Callable<R2> command2, Callable<R3> command3, Callable<R4> command4) Executes the specified commands in parallel and returns a tuple containing the results.
If an error occurs in one task,cancelwill be called for other unfinished tasks.- Type Parameters:
R- the type of the result of the first commandR2- the type of the result of the second commandR3- the type of the result of the third commandR4- the type of the result of the fourth command- Parameters:
command- the first command to be executed in current thread.command2- the second command to be executed in another thread.command3- the third command to be executed in another thread.command4- the fourth command to be executed in another thread.- Returns:
- a tuple containing the results of the four commands
- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
callInParallel
public static <R,R2, Tuple.Tuple5<R,R3, R4, R5> R2, callInParallelR3, R4, R5> (Callable<R> command, Callable<R2> command2, Callable<R3> command3, Callable<R4> command4, Callable<R5> command5) Executes the specified commands in parallel and returns a tuple containing the results.
If an error occurs in one task,cancelwill be called for other unfinished tasks.- Type Parameters:
R- the type of the result of the first commandR2- the type of the result of the second commandR3- the type of the result of the third commandR4- the type of the result of the fourth commandR5- the type of the result of the fifth command- Parameters:
command- the first command to be executed in current thread.command2- the second command to be executed in another thread.command3- the third command to be executed in another thread.command4- the fourth command to be executed in another thread.command5- the fifth command to be executed in another thread.- Returns:
- a tuple containing the results of the five commands
- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
callInParallel
Executes the specified collection of commands/tasks in parallel.
If an error occurs in one task,cancelwill be called for other unfinished tasks.- Parameters:
commands- the collection of commands/tasks to be executed asynchronously, except the first one which is executed in current thread.- Returns:
- a list containing the results of all commands
- Throws:
Exception- if an error occurs during the execution of any command- See Also:
-
callInParallel
public static <R> List<R> callInParallel(Collection<? extends Callable<? extends R>> commands, Executor executor) throws IllegalArgumentException Executes the specified collection of commands/tasks in parallel.
If an error occurs in one task,cancelwill be called for other unfinished tasks.- Parameters:
commands- the collection of commands/tasks to be executed asynchronously by the specified executor, except the first one which is executed in current thread.executor- the executor to use for processing- Returns:
- a list containing the results of all commands
- Throws:
Exception- if an error occurs during the execution of any commandIllegalArgumentException- See Also:
-
runByBatch
public static <T,E extends Exception> void runByBatch(T[] a, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, EExecutes the given action on batches of elements from the provided array.
ThebatchActionmust not update or cache the input batch elements.- Type Parameters:
T- The type of the elements in the array.E- The type of the exception that the action may throw.- Parameters:
a- The array whose elements are to be processed.batchSize- The size of the batches to be processed at a time.batchAction- The action to be executed on each batch of elements. ThebatchActionmust not update or cache the input batch elements.- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception> void runByBatch(Iterable<? extends T> iter, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, EExecutes the given action on batches of elements from the provided iterable.
ThebatchActionmust not update or cache the input batch elements.- Type Parameters:
T- The type of the elements in the iterable.E- The type of the exception that the action may throw.- Parameters:
iter- The iterable whose elements are to be processed.batchSize- The size of the batches to be processed at a time.batchAction- The action to be executed on each batch of elements. ThebatchActionmust not update or cache the input batch elements.- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception> void runByBatch(Iterator<? extends T> iter, int batchSize, Throwables.Consumer<? super List<T>, E> batchAction) throws IllegalArgumentException, EExecutes the given action on batches of elements from the provided iterator.
ThebatchActionmust not update or cache the input batch elements.- Type Parameters:
T- The type of the elements in the iterator.E- The type of the exception that the action may throw.- Parameters:
iter- The iterator whose elements are to be processed.batchSize- The size of the batches to be processed at a time.batchAction- The action to be executed on each batch of elements. ThebatchActionmust not update or cache the input batch elements.- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception, void runByBatchE2 extends Exception> (T[] a, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2Executes the given batch action after applying the specified element consumer on each batch element with index for preparing batch execution.- Type Parameters:
T- The type of the elements in the array.E- The type of the exception that the elementConsumer may throw.E2- The type of the exception that the batchAction may throw.- Parameters:
a- The array whose elements are to be processed.batchSize- The size of the batches to be processed at a time.elementConsumer- The action to be applied to each element with index for preparing batch execution.batchAction- The action to be executed on each batch of elements.- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the elementConsumer throws an exception.E2- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception, void runByBatchE2 extends Exception> (Iterable<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2Executes the given batch action after applying the specified element consumer on each batch element with index for preparing batch execution.- Type Parameters:
T- The type of the elements in the iterable.E- The type of the exception that the elementConsumer may throw.E2- The type of the exception that the batchAction may throw.- Parameters:
iter- The iterable whose elements are to be processed.batchSize- The size of the batches to be processed at a time.elementConsumer- The action to be applied to each element with index for preparing batch execution.batchAction- The action to be executed on each batch of elements.- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the elementConsumer throws an exception.E2- if the batchAction throws an exception.
-
runByBatch
public static <T,E extends Exception, void runByBatchE2 extends Exception> (Iterator<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Runnable<E2> batchAction) throws IllegalArgumentException, E, E2Executes the given batch action after applying the specified element consumer on each batch element with index for preparing batch execution.- Type Parameters:
T- The type of the elements in the iterator.E- The type of the exception that the elementConsumer may throw.E2- The type of the exception that the batchAction may throw.- Parameters:
iter- The iterator whose elements are to be processed.batchSize- The size of the batches to be processed at a time.elementConsumer- The action to be applied to each element with index for preparing batch execution.batchAction- The action to be executed on each batch of elements.- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the elementConsumer throws an exception.E2- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception> (T[] a, int batchSize, Throwables.Function<? super List<T>, R, throws IllegalArgumentException, EE> batchAction) Executes the given function on batches of elements from the provided array.
ThebatchActionmust not update or cache the input batch elements.- Type Parameters:
T- The type of the elements in the array.R- The type of the result returned by the batchAction function.E- The type of the exception that the batchAction may throw.- Parameters:
a- The array whose elements are to be processed.batchSize- The size of the batches to be processed at a time.batchAction- The action to be executed on each batch of elements. ThebatchActionmust not update or cache the input batch elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception> (Iterable<? extends T> iter, int batchSize, Throwables.Function<? super List<T>, R, throws IllegalArgumentException, EE> batchAction) Executes the given function on batches of elements from the provided iterable.
ThebatchActionmust not update or cache the input batch elements.- Type Parameters:
T- The type of the elements in the iterable.R- The type of the result returned by the batchAction function.E- The type of the exception that the batchAction may throw.- Parameters:
iter- The iterable whose elements are to be processed.batchSize- The size of the batches to be processed at a time.batchAction- The action to be executed on each batch of elements. ThebatchActionmust not update or cache the input batch elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception> (Iterator<? extends T> iter, int batchSize, Throwables.Function<? super List<T>, R, throws IllegalArgumentException, EE> batchAction) Executes the given function on batches of elements from the provided iterator.
ThebatchActionmust not update or cache the input batch elements.- Type Parameters:
T- The type of the elements in the iterator.R- The type of the result returned by the batchAction function.E- The type of the exception that the batchAction may throw.- Parameters:
iter- The iterator whose elements are to be processed.batchSize- The size of the batches to be processed at a time.batchAction- The action to be executed on each batch of elements. ThebatchActionmust not update or cache the input batch elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception, E2 extends Exception> (T[] a, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, throws IllegalArgumentException, E, E2E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index.- Type Parameters:
T- The type of the elements in the array.R- The type of the result returned by the batchAction function.E- The type of the exception that the elementConsumer may throw.E2- The type of the exception that the batchAction may throw.- Parameters:
a- The array whose elements are to be processed.batchSize- The size of the batches to be processed at a time.elementConsumer- The action to be applied to each element with index for preparing batch execution.batchAction- The action to be executed on each batch of elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the elementConsumer throws an exception.E2- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception, E2 extends Exception> (Iterable<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, throws IllegalArgumentException, E, E2E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index.- Type Parameters:
T- The type of the elements in the iterable.R- The type of the result returned by the batchAction function.E- The type of the exception that the elementConsumer may throw.E2- The type of the exception that the batchAction may throw.- Parameters:
iter- The iterable whose elements are to be processed.batchSize- The size of the batches to be processed at a time.elementConsumer- The action to be applied to each element with index for preparing batch execution.batchAction- The action to be executed on each batch of elements.- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the elementConsumer throws an exception.E2- if the batchAction throws an exception.
-
callByBatch
public static <T,R, List<R> callByBatchE extends Exception, E2 extends Exception> (Iterator<? extends T> iter, int batchSize, Throwables.IntObjConsumer<? super T, E> elementConsumer, Throwables.Callable<? extends R, throws IllegalArgumentException, E, E2E2> batchAction) Executes the given batch action after applying the specified element consumer on each batch element with index.- Type Parameters:
T- The type of the elements in the iterator.R- The type of the result returned by the batchAction function.E- The type of the exception that the elementConsumer may throw.E2- The type of the exception that the batchAction may throw.- Parameters:
iter- The iterator whose elements are to be processed.batchSize- The size of the batches to be processed at a time.elementConsumer- The action to be applied to each element with index for preparing batch execution.batchAction- The action to be executed on each batch of elements.- Returns:
- A list of results returned by the batchAction function for each batch of elements.
- Throws:
IllegalArgumentException- if the batchSize is not positive.E- if the elementConsumer throws an exception.E2- if the batchAction throws an exception.
-
runUninterruptibly
public static void runUninterruptibly(Throwables.Runnable<InterruptedException> cmd) throws IllegalArgumentException Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
cmd-- Throws:
IllegalArgumentException
-
runUninterruptibly
public static void runUninterruptibly(Throwables.LongConsumer<InterruptedException> cmd, long timeoutInMillis) throws IllegalArgumentException Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
cmd- the command to execute with the remaining time in millisecondstimeoutInMillis-- Throws:
IllegalArgumentException
-
runUninterruptibly
public static void runUninterruptibly(@NotNull Throwables.BiConsumer<Long, TimeUnit, throws IllegalArgumentExceptionInterruptedException> cmd, long timeout, @NotNull TimeUnit unit) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
cmd- the command to execute with the remaining time and unittimeout-unit-- Throws:
IllegalArgumentException- if the specifiedunit/cmdisnull.
-
callUninterruptibly
public static <T> T callUninterruptibly(Throwables.Callable<T, InterruptedException> cmd) throws IllegalArgumentExceptionNote: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Type Parameters:
T-- Parameters:
cmd-- Returns:
- Throws:
IllegalArgumentException
-
callUninterruptibly
public static <T> T callUninterruptibly(Throwables.LongFunction<? extends T, InterruptedException> cmd, long timeoutInMillis) throws IllegalArgumentExceptionNote: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Type Parameters:
T-- Parameters:
cmd- the command to execute with the remaining time in millisecondstimeoutInMillis-- Returns:
- Throws:
IllegalArgumentException
-
callUninterruptibly
public static <T> T callUninterruptibly(@NotNull Throwables.BiFunction<Long, TimeUnit, throws IllegalArgumentExceptionT, InterruptedException> cmd, long timeout, @NotNull TimeUnit unit) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Type Parameters:
T-- Parameters:
cmd- the command to execute with the remaining time and unittimeout-unit-- Returns:
- Throws:
IllegalArgumentException- if the specifiedunit/cmdisnull.
-
sleep
public static void sleep(long timeoutInMillis) Pauses the execution of the current thread for a specified time.- Parameters:
timeoutInMillis- The time, in milliseconds, to pause the thread.
-
sleep
Pauses the execution of the current thread for a specified time.- Parameters:
timeout- The time to pause the thread. The unit of time is determined by the unit parameter.unit- The unit of time for the timeout parameter. This should be a valid TimeUnit enumeration value.- Throws:
IllegalArgumentException- if the specifiedunitisnull.
-
sleepUninterruptibly
public static void sleepUninterruptibly(long timeoutInMillis) Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
timeoutInMillis-
-
sleepUninterruptibly
public static void sleepUninterruptibly(long timeout, @NotNull TimeUnit unit) throws IllegalArgumentException Note: Copied from Google Guava under Apache License v2.0
If a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.- Parameters:
timeout-unit-- Throws:
IllegalArgumentException- if the specifiedunitisnull.
-
tryOrEmptyIfExceptionOccurred
Executes the givenCallableand returns aNullablecontaining the result. If an exception occurs during the execution, an emptyNullableis returned.- Type Parameters:
R- the type of the result- Parameters:
cmd- theCallableto be executed- Returns:
- a
Nullablecontaining the result or an emptyNullableif an exception occurs - See Also:
-
tryOrEmptyIfExceptionOccurred
@Beta public static <T,R> u.Nullable<R> tryOrEmptyIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func) Executes the given function with the provided initial value and returns aNullablecontaining the result. If an exception occurs during the execution, an emptyNullableis returned.- Type Parameters:
T- the type of the initial valueR- the type of the result- Parameters:
init- the initial value to be passed to the functionfunc- the function to be executed- Returns:
- a
Nullablecontaining the result or an emptyNullableif an exception occurs - See Also:
-
tryOrDefaultIfExceptionOccurred
@Beta public static <R> R tryOrDefaultIfExceptionOccurred(Callable<R> cmd, R defaultIfExceptionOccurred) Executes the givenCallableand returns the result. If an exception occurs during the execution, the provided default value is returned.- Type Parameters:
R- the type of the result- Parameters:
cmd- theCallableto be executeddefaultIfExceptionOccurred- the default value to return if an exception occurs- Returns:
- the result of the
Callableor the default value if an exception occurs - See Also:
-
tryOrDefaultIfExceptionOccurred
@Beta public static <T,R> R tryOrDefaultIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func, R defaultIfExceptionOccurred) Executes the given function with the provided initial value and returns the result. If an exception occurs during the execution, the provided default value is returned.- Type Parameters:
T- the type of the initial valueR- the type of the result- Parameters:
init- the initial value to be passed to the functionfunc- the function to be executeddefaultIfExceptionOccurred- the default value to return if an exception occurs- Returns:
- the result of the function or the default value if an exception occurs
- See Also:
-
tryOrDefaultIfExceptionOccurred
@Beta public static <R> R tryOrDefaultIfExceptionOccurred(Callable<R> cmd, Supplier<R> supplierForDefaultIfExceptionOccurred) Executes the givenCallableand returns the result. If an exception occurs during the execution, the result from the provided supplier is returned.- Type Parameters:
R- the type of the result- Parameters:
cmd- theCallableto be executedsupplierForDefaultIfExceptionOccurred- the supplier to provide the default value if an exception occurs- Returns:
- the result of the
Callableor the result from the supplier if an exception occurs - See Also:
-
tryOrDefaultIfExceptionOccurred
@Beta public static <T,R> R tryOrDefaultIfExceptionOccurred(T init, Throwables.Function<? super T, ? extends R, ? extends Exception> func, Supplier<R> supplierForDefaultIfExceptionOccurred) Executes the given function with the provided initial value and returns the result. If an exception occurs during the execution, the result from the provided supplier is returned.- Type Parameters:
T- the type of the initial valueR- the type of the result- Parameters:
init- the initial value to be passed to the functionfunc- the function to be executedsupplierForDefaultIfExceptionOccurred- the supplier to provide the default value if an exception occurs- Returns:
- the result of the function or the result from the supplier if an exception occurs
- See Also:
-
ifOrEmpty
@Beta public static <R,E extends Exception> u.Nullable<R> ifOrEmpty(boolean b, Throwables.Supplier<R, E> supplier) throws EReturns aNullablecontaining the result of the given supplier if the condition istrue. If the condition isfalse, returns an emptyNullable.- Type Parameters:
R- the type of the resultE- the type of the exception that the supplier may throw- Parameters:
b- the condition to evaluatesupplier- the supplier to provide the result if the condition is true- Returns:
- a
Nullablecontaining the result of the supplier if the condition istrue, otherwise an empty Nullable - Throws:
E- if the supplier throws an exception
-
ifOrElse
@Deprecated public static <E1 extends Exception,E2 extends Exception> void ifOrElse(boolean b, Throwables.Runnable<E1> actionForTrue, Throwables.Runnable<E2> actionForFalse) throws E1, E2 Deprecated.it's not a good idea? if-else is better?Executes the provided actions based on the boolean condition.- Type Parameters:
E1- The type of exception that the first action may throw.E2- The type of exception that the second action may throw.- Parameters:
b- The boolean condition to test.actionForTrue- The action to be executed if the condition istrue.actionForFalse- The action to be executed if the condition isfalse.- Throws:
E1- if the condition istrueand the execution of actionForTrue throws this exception.E2- if the condition isfalseand the execution of actionForFalse throws this exception.
-
ifNotNull
@Beta public static <T,E extends Exception> void ifNotNull(T obj, Throwables.Consumer<? super T, E> cmd) throws EExecutes the givenConsumerif the provided object is notnull.- Type Parameters:
T- the type of the objectE- the type of the exception that the consumer may throw- Parameters:
obj- the object to be checked for nullcmd- theConsumerto be executed if the object is not null- Throws:
E- if the consumer throws an exception
-
ifNotEmpty
@Beta public static <CS extends CharSequence,E extends Exception> void ifNotEmpty(CS c, Throwables.Consumer<? super CS, E> cmd) throws EExecutes the provided action if the givenCharSequenceis not empty.- Type Parameters:
CS- The type of theCharSequence.E- The type of exception that the action may throw.- Parameters:
c- TheCharSequenceto be tested for emptiness.cmd- The action to be executed if theCharSequenceis not empty.- Throws:
E- if the execution of the action throws this exception.
-
ifNotEmpty
@Beta public static <C extends Collection,E extends Exception> void ifNotEmpty(C c, Throwables.Consumer<? super C, E> cmd) throws EExecutes the provided action if the given collection is not empty.- Type Parameters:
C- The type of the collection.E- The type of exception that the action may throw.- Parameters:
c- The collection to be tested for emptiness.cmd- The action to be executed if the collection is not empty.- Throws:
E- if the execution of the action throws this exception.
-
ifNotEmpty
@Beta public static <M extends Map,E extends Exception> void ifNotEmpty(M m, Throwables.Consumer<? super M, E> cmd) throws EExecutes the provided action if the given map is not empty.- Type Parameters:
M- The type of the map.E- The type of exception that the action may throw.- Parameters:
m- The map to be tested for emptiness.cmd- The action to be executed if the map is not empty.- Throws:
E- if the execution of the action throws this exception.
-
lazyInit
Creates a lazy-initialized supplier from the provided supplier. The supplier's get() method will not be called until necessary and only be called only because the returned value will be cached.- Type Parameters:
T- The type of results supplied by this supplier- Parameters:
supplier- The supplier to be lazily initialized- Returns:
- A lazy-initialized supplier
-
lazyInitialize
@Beta public static <T,E extends Exception> Throwables.Supplier<T,E> lazyInitialize(Throwables.Supplier<T, E> supplier) Creates a lazy-initialized supplier from the provided supplier. The supplier's get() method will not be called until necessary and only be called only because the returned value will be cached.- Type Parameters:
T- The type of results supplied by this supplier- Parameters:
supplier- The supplier to be lazily initialized- Returns:
- A lazy-initialized supplier
-
toRuntimeException
Converts the provided exception to a runtime exception.- Parameters:
e- The exception to be converted to a runtime exception.- Returns:
- A RuntimeException that represents the provided exception.
- See Also:
-
toRuntimeException
Converts the specifiedThrowableto aRuntimeExceptionif it's a checkedexceptionor anError, otherwise returns itself.- Parameters:
e- The throwable to be converted to a runtime exception.- Returns:
- A RuntimeException that represents the provided throwable.
- See Also:
-
toRuntimeException
Converts the specifiedThrowableto aRuntimeExceptionif it's a checked exception, or throws it if it's anError, based on the provided flag.- Parameters:
e- the throwable to be converted to a runtime exception or thrown if it's an errorthrowIfItIsError- a flag indicating whether to throw the throwable if it's an error- Returns:
- a RuntimeException that represents the provided throwable
- Throws:
Error- if the throwable is an error and the flag is set to true- See Also:
-
println
public static <T> T println(T obj) Prints the given object's string representation to the standard output stream (System.out) and returns the object. The object's string representation is obtained by callingN.toString(Object)method.- Type Parameters:
T- The type of the object to be printed.- Parameters:
obj- The object to be printed.- Returns:
- The same object that was printed.
-
fprintln
Prints the formatted string to the standard output using the specified format and arguments.- Type Parameters:
T- the type of the arguments- Parameters:
format- the format stringargs- the arguments referenced by the format specifiers in the format string- See Also:
-
typeOf
public static <T> com.landawn.abacus.type.Type<T> typeOf(@NotNull String typeName) throws IllegalArgumentException Gets a Type by the given type name.- Parameters:
typeName- the name of the type to be retrieved.- Returns:
- the Type corresponding to the given type name.
- Throws:
IllegalArgumentException- if the specifiedtypeNameisnull.
-
typeOf
public static <T> com.landawn.abacus.type.Type<T> typeOf(@NotNull Class<?> cls) throws IllegalArgumentException Gets a Type by the givenClass.- Parameters:
typeName- the name of the type to be retrieved.- Returns:
- the Type corresponding to the given type name.
- Throws:
IllegalArgumentException- if the specifiedClassisnull.
-
defaultValueOf
Returns the default value of the given class type.- Type Parameters:
T-- Parameters:
cls- the class type for which the default value is to be returned.- Returns:
- the default value of the given class type. For example, for an Integer class type, it will return 0.
- Throws:
IllegalArgumentException- if the specified class type isnull.
-
defaultIfNull
Returns the default value of the given type if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-defaultForNull-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnullor itself if the specified object is notnull.- Parameters:
c-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnullor itself if the specified object is notnull.- Parameters:
c-defaultForNull-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-defaultForNull-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-defaultForNull-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-defaultForNull-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-defaultForNull-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-defaultForNull-- Returns:
-
defaultIfNull
Returns the default value of the given type if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-- Returns:
-
defaultIfNull
Returns the specified default value if the specified object isnullor itself if the specified object is notnull.- Parameters:
b-defaultForNull-- Returns:
-
defaultIfNull
Returns the specified default value if the given object isnull, otherwise returns the object itself.- Type Parameters:
T- the type of the object- Parameters:
obj- the object to check fornulldefaultForNull- the default value to return ifobjisnull- Returns:
objif it is notnull, otherwisedefaultForNull- Throws:
IllegalArgumentException- if the specified default value isnull.
-
defaultIfNull
Returns the default value provided by specifiedSupplierif the specified object isnullor itself if the specified object is notnull.- Type Parameters:
T-- Parameters:
obj-supplierForDefault-- Returns:
-
defaultIfEmpty
public static <T extends CharSequence> T defaultIfEmpty(T str, T defaultStr) throws IllegalArgumentException Returns the specified default value if the specified object is empty or itself if the specified object is not empty.- Type Parameters:
T-- Parameters:
str-defaultStr-- Returns:
- Throws:
IllegalArgumentException- if the specified default charSequence value isnull.- See Also:
-
defaultIfEmpty
public static <T extends CharSequence> T defaultIfEmpty(T str, Supplier<? extends T> getterForDefaultStr) Returns the default value provided by specifiedSupplierif the specified object is empty or itself if the specified object is not empty.- Type Parameters:
T-- Parameters:
str-getterForDefaultStr-- Returns:
- See Also:
-
defaultIfBlank
public static <T extends CharSequence> T defaultIfBlank(T str, T defaultStr) throws IllegalArgumentException Returns the specified default value if the specified object is blank or itself if the specified object is not blank.- Type Parameters:
T-- Parameters:
str-defaultStr-- Returns:
- Throws:
IllegalArgumentException- if the specified default charSequence value isnull.- See Also:
-
defaultIfBlank
public static <T extends CharSequence> T defaultIfBlank(T str, Supplier<? extends T> getterForDefaultStr) Returns the default value provided by specifiedSupplierif the specified object is blank or itself if the specified object is not blank.- Type Parameters:
T-- Parameters:
str-getterForDefaultStr-- Returns:
- See Also:
-
defaultIfEmpty
public static <T extends Collection<?>> T defaultIfEmpty(T c, T defaultColl) throws IllegalArgumentException Returns the specified default value if the specified Collection/Map is empty or itself if the specified object is not empty.- Type Parameters:
T-- Parameters:
c-defaultColl-- Returns:
- Throws:
IllegalArgumentException- if the specified default collection value isnull.
-
defaultIfEmpty
public static <T extends Map<?,?>> T defaultIfEmpty(T m, T defaultMap) throws IllegalArgumentException Returns the specified default value if the specified Collection/Map is empty or itself if the specified object is not empty.- Type Parameters:
T-- Parameters:
m-defaultMap-- Returns:
- Throws:
IllegalArgumentException- if the specified default map value isnull.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value. Returns "true" if the value is
true, "false" otherwise.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation.- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value.
-
stringOf
Converts the given value to its corresponding String representation byType.stringOf(Object).- Parameters:
val- the value to be converted.- Returns:
- the String representation of the given value.
nullif the specified object is null - See Also:
-
valueOf
Converts the given string to its corresponding value of the specified target type bytypeOf(targetType).valueOf(str).- Type Parameters:
T- The type of the target object after conversion.- Parameters:
str- The string to be converted.targetType- The class of the target type to which the string is to be converted.- Returns:
- The converted value of the specified target type. If the input string is
null, it returns the default value of the target type. - Throws:
IllegalArgumentException- if the specified target type isnull.- See Also:
-
registerConverter
public static boolean registerConverter(@NotNull Class<?> srcClass, BiFunction<?, Class<?>, throws IllegalArgumentException?> converter) Registers a converter for a specific source class. The converter is a function that takes an object of the source class and a target class, and converts the source object into an instance of the target class.- Type Parameters:
T- The type of the source object to be converted.R- The type of the target object after conversion.- Parameters:
srcClass- The source class that the converter can convert from. This must not be a built-in class.converter- The converter function that takes a source object and a target class, and returns an instance of the target class.- Returns:
trueif there is noconverterregistered with specifiedsrcClassyet before this call.- Throws:
IllegalArgumentException- if the specifiedsrcClassis a built-in class or if eithersrcClassorconverterisnull.
-
convert
public static <T> T convert(Object srcObj, Class<? extends T> targetType) throws IllegalArgumentException, NumberFormatException, RuntimeException Converts the given source object to the specified target type. If the source object isnull, the default value of the target type is returned. If the source object can be converted to the target type, an instance of the target type is returned.- Type Parameters:
T- The type of the target object after conversion.- Parameters:
srcObj- The source object to be converted. Ifnull, the default value of the target type is returned.targetType- The class of the target type to which the source object is to be converted.- Returns:
- An instance of the target type converted from the source object, or the default value of the target type if the source object is
null. - Throws:
IllegalArgumentException- if the source object cannot be converted to the target type.NumberFormatException- if string value of the source object cannot be parsed to the target(Number) type.RuntimeException- if any other error occurs during the conversion.
-
convert
public static <T> T convert(Object srcObj, com.landawn.abacus.type.Type<? extends T> targetType) throws IllegalArgumentException, NumberFormatException, RuntimeException Converts the given source object to the specified target type using the provided Type instance. If the source object isnull, the default value of the target type is returned. If the source object can be converted to the target type, an instance of the target type is returned.- Type Parameters:
T- The type of the target object after conversion.- Parameters:
srcObj- The source object to be converted.targetType- The Type instance of the target type to which the source object is to be converted.- Returns:
- An instance of the target type converted from the source object, or the default value of the target type if the source object is
null. - Throws:
IllegalArgumentException- if the source object cannot be converted to the target type.NumberFormatException- if string value of the source object cannot be parsed to the target(Number) type.RuntimeException- if any other error occurs during the conversion.
-
castIfAssignable
Casts the given object to the specified target type if possible. If the object isnullor cannot be assigned to the target type, an emptyNullableis returned. Note thatnullcan be assigned to any Object type except primitive types: boolean/char/byte/short/int/long/double.- Type Parameters:
T- The type of the target object after casting.- Parameters:
val- The object to be casted.targetType- The class of the target type to which the object is to be casted.- Returns:
- A
Nullablecontaining the casted object if the casting is successful, or an emptyNullableif the object isnullor cannot be casted to the target type.
-
castIfAssignable
@Beta public static <T> u.Nullable<T> castIfAssignable(Object val, com.landawn.abacus.type.Type<? extends T> targetType) Casts the given object to the specified target type if possible using the provided Type instance. If the object isnullor cannot be assigned to the target type, an emptyNullableis returned. Note thatnullcan be assigned to any Object type except primitive types: boolean/char/byte/short/int/long/double.- Type Parameters:
T- The type of the target object after casting.- Parameters:
val- The object to be casted.targetType- The Type instance of the target type to which the object is to be casted.- Returns:
- A
Nullablecontaining the casted object if the casting is successful, or an emptyNullableif the object isnullor cannot be casted to the target type.
-
getPropNames
Retrieves the property names of the given bean class.- Parameters:
beanClass- the class of the bean whose property names are to be retrieved.- Returns:
- an ImmutableList of strings representing the property names of the given bean class.
- Throws:
IllegalArgumentException- if the specified bean class isnull.- See Also:
-
getPropNames
Retrieves the property names of the given bean class excluding the specified property names.- Parameters:
beanClass- the class of the bean whose property names are to be retrieved.propNameToExclude- a set of property names to be excluded from the returned list.- Returns:
- a List of strings representing the property names of the given bean class excluding the specified property names.
- Throws:
IllegalArgumentException- if the specified bean class isnull.- See Also:
-
getPropNames
Retrieves the property names of the given bean object.- Parameters:
bean- The bean object whose property names are to be retrieved.- Returns:
- A list of strings representing the property names of the given bean object.
- Throws:
IllegalArgumentException- if the specified bean object isnull.- See Also:
-
getPropNames
Retrieves the property names of the given bean object.- Parameters:
bean- The bean object whose property names are to be retrieved.ignoreNullValue- Iftrue, the method will ignore property names withnullvalues.- Returns:
- A list of strings representing the property names of the given bean object. If
ignoreNullValueistrue, properties withnullvalues are not included in the list. - Throws:
IllegalArgumentException- if the specified bean object isnull.- See Also:
-
getPropValue
Retrieves the value of the specified property from the given bean object.- Type Parameters:
T- The type of the property value.- Parameters:
bean- The bean object from which the property value is to be retrieved.propName- The name of the property whose value is to be retrieved.- Returns:
- The value of the specified property of the given bean object.
- Throws:
IllegalArgumentException- if the specified bean object isnull.- See Also:
-
getPropValue
Retrieves the value of the specified property from the given bean object.- Type Parameters:
T- The type of the property value.- Parameters:
bean- The bean object from which the property value is to be retrieved.propName- The name of the property whose value is to be retrieved.ignoreUnmatchedProperty- Iftrue, the method will not throw an exception if the property does not exist in the bean object.- Returns:
- The value of the specified property of the given bean object.
- Throws:
IllegalArgumentException- if the specified bean object isnullor if the property does not exist and ignoreUnmatchedProperty isfalse.- See Also:
-
setPropValue
Deprecated.Sets the value of the specified property in the given bean object.
Refer to setPropValue(Method, Object, Object).- Parameters:
bean- The bean object in which the property value is to be set.propName- The name of the property whose value is to be set. The property name is case insensitive.propValue- The new value to be set for the specified property in the given bean object.- Throws:
IllegalArgumentException- if the specified bean object isnull.- See Also:
-
clone
Clones the given object. The object must be serializable and deserializable throughKryoorJSON.- Type Parameters:
T-- Parameters:
obj- a Java object which must be serializable and deserializable throughKryoorJSON.- Returns:
nullifbeanisnull
-
clone
public static <T> T clone(Object obj, @NotNull Class<? extends T> targetType) throws IllegalArgumentException Deeply copy by: obj -> serialize -> kryo/Json -> deserialize -> new object.- Type Parameters:
T-- Parameters:
obj- a Java object which must be serializable and deserialiable throughKryoorJSON.targetType-- Returns:
- a new instance of
targetTypeeven ifbeanisnull. - Throws:
IllegalArgumentException- iftargetTypeisnull.
-
copy
Returns a copy of the given source bean.- Type Parameters:
T- the type of the source bean- Parameters:
sourceBean- the source bean to copy- Returns:
- a new instance of the same class with the same properties copied from the source bean, or
nullif the source bean isnull
-
copy
Returns a copy of the given source bean with selected properties.- Type Parameters:
T- the type of the source bean- Parameters:
sourceBean- the source bean to copyselectPropNames- the collection of property names to be copied- Returns:
- a new instance of the same class with the selected properties copied from the source bean, or
nullif the source bean isnull
-
copy
Returns a copy of the given source bean with properties filtered by the specified predicate.- Type Parameters:
T- the type of the source bean- Parameters:
sourceBean- the source bean to copypropFilter- the predicate to filter properties to be copied- Returns:
- a new instance of the same class with the filtered properties copied from the source bean, or
nullif the source bean isnull
-
copy
public static <T> T copy(Object sourceBean, Class<? extends T> targetType) throws IllegalArgumentException Returns a new instance of specifiedtargetTypewith properties copied from the given source bean.- Type Parameters:
T- the type of the target bean- Parameters:
sourceBean- the source bean to copytargetType- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null - Throws:
IllegalArgumentException- if the specifiedtargetTypeisnull
-
copy
public static <T> T copy(Object sourceBean, Collection<String> selectPropNames, @NotNull Class<? extends T> targetType) throws IllegalArgumentException Returns a new instance of specifiedtargetTypewith properties copied from the given source bean with selected properties.- Type Parameters:
T- the type of the target bean- Parameters:
sourceBean- the source bean to copyselectPropNames- the collection of property names to be copiedtargetType- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null - Throws:
IllegalArgumentException- if the specifiedtargetTypeisnull
-
copy
public static <T> T copy(Object sourceBean, Collection<String> selectPropNames, Function<String, String> propNameConverter, @NotNull Class<? extends T> targetType) throws IllegalArgumentExceptionReturns a new instance of specifiedtargetTypewith properties copied from the given source bean with selected properties.- Type Parameters:
T- the type of the target bean- Parameters:
sourceBean- the source bean to copyselectPropNames- the collection of property names to be copiedpropNameConverter- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.targetType- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null - Throws:
IllegalArgumentException- if the specifiedtargetTypeisnull
-
copy
public static <T> T copy(Object sourceBean, BiPredicate<? super String, ?> propFilter, Class<? extends T> targetType) throws IllegalArgumentExceptionReturns a new instance of specifiedtargetTypewith properties copied from the given source bean, filtered by the specified predicate.- Type Parameters:
T- the type of the target bean- Parameters:
sourceBean- the source bean to copypropFilter- A BiPredicate used to filter the properties to be copied. The predicate takes a property name and its value, and returnstrueif the property should be copied.targetType- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null - Throws:
IllegalArgumentException- iftargetBeanisnull.
-
copy
public static <T> T copy(Object sourceBean, BiPredicate<? super String, ?> propFilter, Function<String, throws IllegalArgumentExceptionString> propNameConverter, Class<? extends T> targetType) Returns a new instance of specifiedtargetTypewith properties copied from the given source bean, filtered by the specified predicate.- Type Parameters:
T- the type of the target bean- Parameters:
sourceBean- the source bean to copypropFilter- A BiPredicate used to filter the properties to be copied. The predicate takes a property name and its value, and returnstrueif the property should be copied.propNameConverter- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.targetType- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null - Throws:
IllegalArgumentException- iftargetBeanisnull.
-
copy
public static <T> T copy(Object sourceBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames, @NotNull Class<? extends T> targetType) throws IllegalArgumentException Returns a new instance of specifiedtargetTypewith properties copied from the given source bean, except the properties specified in theignoredPropNamesset.- Type Parameters:
T- the type of the target bean- Parameters:
sourceBean- the source bean to copyignoreUnmatchedProperty- iftrue, unmatched properties will be ignored, otherwise an exception will be thrown if unmatched properties are foundignoredPropNames- the set of property names to be ignored during copyingtargetType- the class of the target type- Returns:
- a new instance of the target type, even if the source bean is
null - Throws:
IllegalArgumentException- if the specifiedtargetTypeisnull
-
merge
Merges the properties from the source object into the target object. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, T targetBean, BinaryOperator<?> mergeFunc) throws IllegalArgumentException Merges the properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.mergeFunc- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, T targetBean, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) throws IllegalArgumentExceptionMerges the properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.propNameConverter- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.mergeFunc- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, Collection<String> selectPropNames) throws IllegalArgumentException Merges the selected properties from the source object into the target object. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.selectPropNames- The collection of property names to be merged.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, Collection<String> selectPropNames, BinaryOperator<?> mergeFunc) throws IllegalArgumentException Merges the selected properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.selectPropNames- The collection of property names to be merged.mergeFunc- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, Collection<String> selectPropNames, Function<String, String> propNameConverter) throws IllegalArgumentExceptionMerges the selected properties from the source object into the target object. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.selectPropNames- The collection of property names to be merged.propNameConverter- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, Collection<String> selectPropNames, Function<String, String> propNameConverter, BinaryOperator<?> mergeFunc) throws IllegalArgumentExceptionMerges the selected properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.selectPropNames- The collection of property names to be merged.propNameConverter- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.mergeFunc- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, T targetBean, BiPredicate<? super String, ?> propFilter) throws IllegalArgumentExceptionMerges the filtered properties from the source object into the target object, The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.propFilter- A BiPredicate used to filter the properties to be merged. The predicate takes a property name and its value, and returnstrueif the property should be merged.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, BiPredicate<? super String, ?> propFilter, BinaryOperator<?> mergeFunc) throws IllegalArgumentExceptionMerges the filtered properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object after merging.- Parameters:
sourceBean- The source object whose properties are to be merged. This object should allow access to properties using getter methods.targetBean- The target object to which the properties are to be merged. This object should allow access to properties using setter methods.propFilter- A BiPredicate used to filter the properties to be merged. The predicate takes a property name and its value, and returnstrueif the property should be merged.mergeFunc- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- if targetBean isnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, BiPredicate<? super String, ?> propFilter, Function<String, throws IllegalArgumentExceptionString> propNameConverter) Merges the filtered properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object after merging.- Parameters:
sourceBean- The source object whose properties are to be merged. This object should allow access to properties using getter methods.targetBean- The target object to which the properties are to be merged. This object should allow access to properties using setter methods.propFilter- A BiPredicate used to filter the properties to be merged. The predicate takes a property name and its value, and returnstrueif the property should be merged.propNameConverter- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- if targetBean isnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, BiPredicate<? super String, ?> propFilter, Function<String, throws IllegalArgumentExceptionString> propNameConverter, BinaryOperator<?> mergeFunc) Merges the filtered properties from the source object into the target object using the specified merge function. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object after merging.- Parameters:
sourceBean- The source object whose properties are to be merged. This object should allow access to properties using getter methods.targetBean- The target object to which the properties are to be merged. This object should allow access to properties using setter methods.propFilter- A BiPredicate used to filter the properties to be merged. The predicate takes a property name and its value, and returnstrueif the property should be merged.propNameConverter- A Function used to convert the property names from the source object to the target object. The function takes a property name from the source object and returns the corresponding property name in the target object.mergeFunc- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- if targetBean isnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames) throws IllegalArgumentException Merges the properties from the source object into the target object, except the properties specified in theignoredPropNamesset. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.ignoreUnmatchedProperty- iftrue, unmatched properties will be ignored, otherwise an exception will be thrown if unmatched properties are foundignoredPropNames- The set of property names to be ignored during merging.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
merge
public static <T> T merge(Object sourceBean, @NotNull T targetBean, boolean ignoreUnmatchedProperty, Set<String> ignoredPropNames, BinaryOperator<?> mergeFunc) throws IllegalArgumentException Merges the properties from the source object into the target object using the specified merge function, except the properties specified in theignoredPropNamesset. The source object's properties will overwrite the same properties in the target object.- Type Parameters:
T- The type of the target object.- Parameters:
sourceBean- The source object from which properties are to be copied. This object should allow access to properties using getter methods.targetBean- The target object into which properties are to be copied. This object should allow access to properties using setter methods.ignoreUnmatchedProperty- iftrue, unmatched properties will be ignored, otherwise an exception will be thrown if unmatched properties are foundignoredPropNames- The set of property names to be ignored during merging.mergeFunc- A BinaryOperator used to merge the property values from the source object and the target object. The operator takes two parameters: the source property value and the target property value, and returns the resolved value to be set in the target object.- Returns:
- The specified target object with the merged properties.
- Throws:
IllegalArgumentException- iftargetBeanisnull.
-
erase
Erases the properties of the given bean object. This method sets the properties specified by the property names to their default values. The default value is determined by the type of the property. For example, primitive numeric properties are set to 0, primitive boolean properties are set tofalse, and object properties are set tonull.- Parameters:
bean- The bean object whose properties are to be erased. If this isnull, the method does nothing.propNames- The names of the properties to be erased. These should correspond to the getter/setter methods in the bean object. If this is empty, the method does nothing.
-
erase
Erases the properties of the given bean object. This method sets the properties specified by the property names to their default values. The default value is determined by the type of the property. For example, primitive numeric properties are set to 0, primitive boolean properties are set tofalse, and object properties are set tonull.- Parameters:
bean- The bean object whose properties are to be erased. If this isnull, the method does nothing.propNames- The names of the properties to be erased. These should correspond to the getter/setter methods in the bean object. If this is empty, the method does nothing.
-
eraseAll
Erases all the properties of the given bean object. This method sets all properties of the bean object to their default values. The default value is determined by the type of the property. For example, primitive numeric properties are set to 0, primitive boolean properties are set tofalse, and object properties are set tonull.- Parameters:
bean- The bean object whose properties are to be erased. If this isnull, the method does nothing.
-
enumListOf
Returns an immutable/unmodifiable list of all the enum constants in the specified enum class. This method retrieves all the enum constants defined in the given enum class and returns them as an ImmutableList. The order of the constants in the list is the order in which they're declared in the enum class.- Type Parameters:
E- The type of the enum constants. This should be an enum type.- Parameters:
enumClass- The class object of the enum type whose constants are to be listed. Must not benull.- Returns:
- An ImmutableList containing all the enum constants in the order they're declared in the enum class.
-
enumSetOf
Returns an immutable/unmodifiable set of all the enum constants in the specified enum class. This method retrieves all the enum constants defined in the given enum class and returns them as an ImmutableSet. The order of the constants in the set is the order in which they're declared in the enum class.- Type Parameters:
E- The type of the enum constants. This should be an enum type.- Parameters:
enumClass- The class object of the enum type whose constants are to be listed. Must not benull.- Returns:
- An ImmutableSet containing all the enum constants in the order they're declared in the enum class.
-
enumMapOf
Returns an immutable/unmodifiable bi-directional map of all the enum constants in the specified enum class to their names. This method retrieves all the enum constants defined in the given enum class and maps them to their names as an ImmutableBiMap. The order of the constants in the map is the order in which they're declared in the enum class.- Type Parameters:
E- The type of the enum constants. This should be an enum type.- Parameters:
enumClass- The class object of the enum type whose constants are to be listed. Must not benull.- Returns:
- An ImmutableBiMap where each key-value pair corresponds to an enum constant and its name.
-
newProxyInstance
Creates a new proxy instance for the specified interface using the provided invocation handler. This method is a utility for creating dynamic proxies. A dynamic proxy class is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface. Thus, a dynamic proxy class can be used to create an object that can implement an arbitrary set of interfaces specified at runtime.- Type Parameters:
T- The type of the interface for the proxy class to implement.- Parameters:
interfaceClass- The Class object of the interface for the proxy class to implement. Must not benull.h- The invocation handler to dispatch method invocations to. It's a object that implements the InvocationHandler interface.- Returns:
- a proxy instance that implements the specified interface(s) and dispatches method invocations to the specified invocation handler.
- See Also:
-
newProxyInstance
Creates a new proxy instance for the specified interfaces using the provided invocation handler. This method is a utility for creating dynamic proxies. A dynamic proxy class is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface. Thus, a dynamic proxy class can be used to create an object that can implement an arbitrary set of interfaces specified at runtime.- Type Parameters:
T- The type of the interface for the proxy class to implement.- Parameters:
interfaceClasses- The array of Class objects of the interfaces for the proxy class to implement. Must not benull.h- The invocation handler to dispatch method invocations to. It's an object that implements the InvocationHandler interface.- Returns:
- a proxy instance that implements the specified interface(s) and dispatches method invocations to the specified invocation handler.
- See Also:
-
newInstance
Creates a new instance of the specified class.- Type Parameters:
T- the type of the object to be created- Parameters:
cls- the class of the object to be created- Returns:
- a new instance of the specified class
- Throws:
IllegalArgumentException- if the class is abstract or cannot be instantiated- See Also:
-
newBean
Creates a new instance of the specified bean class.- Type Parameters:
T- the type of the object to be created- Parameters:
targetType- the class of the object to be created- Returns:
- a new instance of the specified class
- Throws:
IllegalArgumentException- if the class is abstract or cannot be instantiated
-
newCollection
Creates a new collection of the specified type.- Type Parameters:
T- the type of elements in the collection- Parameters:
targetType- the class of the collection to be created- Returns:
- a new collection of the specified type
- See Also:
-
newCollection
Creates a new collection of the specified type with the given initial size.- Type Parameters:
T- the type of elements in the collection- Parameters:
targetType- the class of the collection to be createdsize- the initial size of the collection- Returns:
- a new collection of the specified type with the given initial size
- See Also:
-
newMap
Creates a new map of the specified type.- Type Parameters:
K- the type of keys maintained by the mapV- the type of mapped values- Parameters:
targetType- the class of the map to be created- Returns:
- a new map of the specified type
- See Also:
-
newMap
Creates a new map of the specified type with the given initial size.- Type Parameters:
K- the type of keys maintained by the mapV- the type of mapped values- Parameters:
targetType- the class of the map to be createdsize- the initial size of the map- Returns:
- a new map of the specified type with the given initial size
- See Also:
-
newArray
Creates a new array of the specified component type and length.- Type Parameters:
T- the type of the array elements- Parameters:
componentType- the class of the component type of the arraylength- the length of the new array- Returns:
- a new array of the specified component type and length
- Throws:
NegativeArraySizeException- if the specified length is negative- See Also:
-
newArray
@SafeVarargs public static <T> T newArray(Class<?> componentType, int... dimensions) throws IllegalArgumentException, NegativeArraySizeException Creates a new array of the specified component type and dimensions.- Type Parameters:
T- the type of the array elements- Parameters:
componentType- the class of the component type of the arraydimensions- the dimensions of the new array- Returns:
- a new array of the specified component type and dimensions
- Throws:
IllegalArgumentException- if the specified component type isnullor if the dimensions are invalidNegativeArraySizeException- if any of the specified dimensions are negative- See Also:
-
newArrayList
Creates a new instance of an ArrayList.- Type Parameters:
T- the type of elements in the list- Returns:
- a new instance of an ArrayList
-
newArrayList
Creates a new instance of an ArrayList with the specified initial capacity.- Type Parameters:
T- the type of elements in the list- Parameters:
initialCapacity- the initial capacity of the list- Returns:
- a new instance of an ArrayList with the specified initial capacity
- See Also:
-
newArrayList
Creates a new instance of an ArrayList with the elements from the specified collection.- Type Parameters:
T- the type of elements in the list- Parameters:
c- the collection whose elements are to be placed into this list- Returns:
- a new instance of an ArrayList containing the elements from the specified collection
- See Also:
-
newLinkedList
Creates a new instance of a LinkedList.- Type Parameters:
T- the type of elements in the list- Returns:
- a new instance of a LinkedList
-
newLinkedList
Creates a new instance of a LinkedList with the elements from the specified collection.- Type Parameters:
T- the type of elements in the list- Parameters:
c- the collection whose elements are to be placed into this list- Returns:
- a new instance of a LinkedList containing the elements from the specified collection
- See Also:
-
newHashSet
Creates a new instance of a HashSet.- Type Parameters:
T- the type of elements in the set- Returns:
- a new instance of a HashSet
-
newHashSet
Creates a new instance of a HashSet with the specified initial capacity.- Type Parameters:
T- the type of elements in the set- Parameters:
initialCapacity- the initial capacity of the set- Returns:
- a new instance of a HashSet with the specified initial capacity
- See Also:
-
newHashSet
Creates a new instance of a HashSet with the elements from the specified collection.- Type Parameters:
T- the type of elements in the set- Parameters:
c- the collection whose elements are to be placed into this set- Returns:
- a new instance of a HashSet containing the elements from the specified collection
- See Also:
-
newLinkedHashSet
Creates a new instance of HashSet.- Type Parameters:
T- the type of elements in the set- Returns:
- a new instance of a HashSet
-
newLinkedHashSet
Creates a new instance of a LinkedHashSet with the specified initial capacity.- Type Parameters:
T- the type of elements in the set- Parameters:
initialCapacity- the initial capacity of the set- Returns:
- a new instance of a LinkedHashSet with the specified initial capacity
- See Also:
-
newLinkedHashSet
Creates a new instance of a LinkedHashSet with the elements from the specified collection.- Type Parameters:
T- the type of elements in the set- Parameters:
c- the collection whose elements are to be placed into this set- Returns:
- a new instance of a LinkedHashSet containing the elements from the specified collection
- See Also:
-
newTreeSet
Creates a new instance of TreeSet.- Type Parameters:
T- the type of elements in the set- Returns:
- a new instance of a TreeSet
-
newTreeSet
Creates a new instance of a TreeSet with the specified comparator.- Type Parameters:
T- the type of elements in the set- Parameters:
comparator- the comparator that will be used to order this set.- Returns:
- a new instance of a TreeSet
- See Also:
-
newTreeSet
Creates a new instance of a TreeSet with the elements from the specified collection.- Type Parameters:
T- the type of elements in the set- Parameters:
c- the collection whose elements are to be placed into this set- Returns:
- a new instance of a TreeSet containing the elements from the specified collection
- See Also:
-
newTreeSet
Creates a new instance of a TreeSet with the elements from the specified sorted set.- Type Parameters:
T- the type of elements in the set- Parameters:
c- the sorted set whose elements are to be placed into this set- Returns:
- a new instance of a TreeSet containing the elements from the specified sorted set
- See Also:
-
newConcurrentHashSet
Creates a new instance of a concurrent hash set byConcurrentHashMap.- Type Parameters:
T- the type of elements in the set- Returns:
- a new instance of a concurrent hash set
- See Also:
-
newConcurrentHashSet
Creates a new instance of a concurrent hash set with the specified initial capacity.- Type Parameters:
T- the type of elements in the set- Parameters:
initialCapacity- the initial capacity of the set- Returns:
- a new instance of a concurrent hash set
- See Also:
-
newConcurrentHashSet
Creates a new instance of a concurrent hash set with the elements from the specified collection.- Type Parameters:
T- the type of elements in the set- Parameters:
c- the collection whose elements are to be placed into this set- Returns:
- a new instance of a concurrent hash set containing the elements from the specified collection
- See Also:
-
newSetFromMap
Returns a set backed by the specified map.- Type Parameters:
E- the type of elements in the set- Parameters:
map- the backing map- Returns:
- a set backed by the specified map
- See Also:
-
newMultiset
Creates a new instance of a Multiset.- Type Parameters:
T- the type of elements in the multiset- Returns:
- a new instance of a Multiset
-
newMultiset
Creates a new instance of a Multiset with the specified initial capacity.- Type Parameters:
T- the type of elements in the multiset- Parameters:
initialCapacity- the initial capacity of the multiset- Returns:
- a new instance of a Multiset with the specified initial capacity
-
newMultiset
Creates a new instance of a Multiset with the specified backed Map type for storing element/occurrence pairs.- Type Parameters:
T- the type of elements in the multiset- Parameters:
valueMapType- the class of the map to be used to store element/occurrence pairs- Returns:
- a new instance of a Multiset with the specified value map type
-
newMultiset
Creates a new instance of a Multiset with the specifiedSupplierwhich provides the map to store element/occurrence pairs.- Type Parameters:
T- the type of elements in the multiset- Parameters:
mapSupplier- the supplier that provides the map to be used to store element/occurrence pairs- Returns:
- a new instance of a Multiset with the specified value map type
-
newMultiset
Creates a new instance of a Multiset with the elements from the specified collection.- Type Parameters:
T- the type of elements in the multiset- Parameters:
c- the collection whose elements are to be placed into this multiset- Returns:
- a new instance of a Multiset containing the elements from the specified collection
-
newArrayDeque
Creates a new instance of an ArrayDeque.- Type Parameters:
T- the type of elements in the deque- Returns:
- a new instance of an ArrayDeque
-
newArrayDeque
Creates a new instance of an ArrayDeque with the specified initial capacity.- Type Parameters:
T- the type of elements in the deque- Parameters:
numElements- the initial capacity of the deque- Returns:
- a new instance of an ArrayDeque with the specified initial capacity
-
newArrayDeque
Creates a new instance of an ArrayDeque with the elements from the specified collection.- Type Parameters:
E- the type of elements in the deque- Parameters:
c- the collection whose elements are to be placed into this deque- Returns:
- a new instance of an ArrayDeque containing the elements from the specified collection
-
newEntry
Creates a new entry with the specified key and value.- Type Parameters:
K- the type of keys maintained by this entryV- the type of mapped values- Parameters:
key- the key to be associated with the entryvalue- the value to be associated with the entry- Returns:
- a new entry with the specified key and value
-
newImmutableEntry
Creates a new immutable entry with the specified key and value.- Type Parameters:
K- the type of keys maintained by this entryV- the type of mapped values- Parameters:
key- the key to be associated with the entryvalue- the value to be associated with the entry- Returns:
- a new immutable entry with the specified key and value
-
newHashMap
Creates a new instance of a HashMap.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Returns:
- a new instance of a HashMap
-
newHashMap
Creates a new instance of a HashMap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
initialCapacity- the initial capacity of the map- Returns:
- a new instance of a HashMap with the specified initial capacity
-
newHashMap
Creates a new instance of a HashMap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
m- the map whose elements are to be placed into this map- Returns:
- a new instance of a HashMap containing the entries from the specified map
-
newHashMap
public static <K,V> Map<K,V> newHashMap(Collection<? extends V> c, Function<? super V, ? extends K> keyExtractor) throws IllegalArgumentExceptionCreates a new instance of a HashMap with the elements from the specified collection.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
c- the collection whose elements are to be placed into this mapkeyExtractor- the function to extract a key from a collection element- Returns:
- a new instance of a HashMap containing the elements from the specified collection
- Throws:
IllegalArgumentException- See Also:
-
newLinkedHashMap
Creates a new instance of a LinkedHashMap.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Returns:
- a new instance of a LinkedHashMap
-
newLinkedHashMap
Creates a new instance of a LinkedHashMap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
initialCapacity- the initial capacity of the map- Returns:
- a new instance of a LinkedHashMap with the specified initial capacity
-
newLinkedHashMap
Creates a new instance of a LinkedHashMap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
m- the map whose elements are to be placed into this map- Returns:
- a new instance of a LinkedHashMap containing the entries from the specified map
-
newLinkedHashMap
public static <K,V> Map<K,V> newLinkedHashMap(Collection<? extends V> c, Function<? super V, ? extends K> keyExtractor) throws IllegalArgumentExceptionCreates a new instance of a LinkedHashMap with the elements from the specified collection.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
c- the collection whose elements are to be placed into this mapkeyExtractor- the function to extract a key from a collection element- Returns:
- a new instance of a LinkedHashMap containing the elements from the specified collection
- Throws:
IllegalArgumentException- See Also:
-
newTreeMap
Creates a new instance of a TreeMap.- Type Parameters:
K- the type of keys maintained by this map, which must be comparableV- the type of mapped values- Returns:
- a new instance of a TreeMap
-
newTreeMap
Creates a new instance of a TreeMap with the specified comparator.- Type Parameters:
C- the type of the comparatorK- the type of keys maintained by this mapV- the type of mapped values- Parameters:
comparator- the comparator that will be used to order this map- Returns:
- a new instance of a TreeMap with the specified comparator
-
newTreeMap
public static <K extends Comparable<? super K>,V> TreeMap<K,V> newTreeMap(Map<? extends K, ? extends V> m) Creates a new instance of a TreeMap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this map, which must be comparableV- the type of mapped values- Parameters:
m- the map whose elements are to be placed into this map- Returns:
- a new instance of a TreeMap containing the entries from the specified map
-
newTreeMap
Creates a new instance of a TreeMap with the entries from the specified sorted map.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
m- the sorted map whose elements are to be placed into this map- Returns:
- a new instance of a TreeMap containing the entries from the specified sorted map
-
newIdentityHashMap
Creates a new instance of an IdentityHashMap.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Returns:
- a new instance of an IdentityHashMap
-
newIdentityHashMap
Creates a new instance of an IdentityHashMap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
initialCapacity- the initial capacity of the map- Returns:
- a new instance of an IdentityHashMap with the specified initial capacity
-
newIdentityHashMap
Creates a new instance of an IdentityHashMap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
m- the map whose elements are to be placed into this map- Returns:
- a new instance of an IdentityHashMap containing the entries from the specified map
-
newConcurrentHashMap
Creates a new instance of a ConcurrentHashMap.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Returns:
- a new instance of a ConcurrentHashMap
-
newConcurrentHashMap
Creates a new instance of a ConcurrentHashMap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
initialCapacity- the initial capacity of the map- Returns:
- a new instance of a ConcurrentHashMap with the specified initial capacity
-
newConcurrentHashMap
Creates a new instance of a ConcurrentHashMap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
m- the map whose elements are to be placed into this map- Returns:
- a new instance of a ConcurrentHashMap containing the entries from the specified map
-
newBiMap
Creates a new instance of a BiMap.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Returns:
- a new instance of a BiMap
-
newBiMap
Creates a new instance of a BiMap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
initialCapacity- the initial capacity of the map- Returns:
- a new instance of a BiMap with the specified initial capacity
-
newBiMap
Creates a new instance of a BiMap with the specified initial capacity and load factor.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
initialCapacity- the initial capacity of the maploadFactor- the load factor of the map- Returns:
- a new instance of a BiMap with the specified initial capacity and load factor
-
newBiMap
public static <K,V> BiMap<K,V> newBiMap(Class<? extends Map> keyMapType, Class<? extends Map> valueMapType) Creates a new instance of a BiMap with the specified key map type which is used to create map to store key/value pairs and value map type which is used to create map to store value/key pairs.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
keyMapType- the class of the map to be used to store key/value pairsvalueMapType- the class of the map to be used to store value/key pairs- Returns:
- a new instance of a BiMap with the specified key and value map types
-
newBiMap
public static <K,V> BiMap<K,V> newBiMap(Supplier<? extends Map<K, V>> keyMapSupplier, Supplier<? extends Map<V, K>> valueMapSupplier) Creates a new instance of a BiMap with the specified key map supplier which provides the map to store key/value pairs and value map supplier which provides the map to store value/key pairs.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
keyMapSupplier- the supplier that provides the map to store key/value pairsvalueMapSupplier- the supplier that provides the map to store value/key pairs- Returns:
- a new instance of a BiMap with the specified key and value map suppliers
-
newMultimap
public static <K,E, Multimap<K,V extends Collection<E>> E, newMultimapV> (Supplier<? extends Map<K, V>> mapSupplier, Supplier<? extends V> valueSupplier) Creates a new instance of a Multimap with the specified map which provides the map to store key/value pairs and value supplier which provides the collection to store values.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collectionV- the type of collection that holds the elements- Parameters:
mapSupplier- the supplier that provides the map to store key/value pairsvalueSupplier- the supplier that provides the collection to store values- Returns:
- a new instance of a Multimap with the specified map and value suppliers
-
newListMultimap
Creates a new instance of a ListMultimap.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Returns:
- a new instance of a ListMultimap
-
newListMultimap
Creates a new instance of a ListMultimap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
initialCapacity- the initial capacity of the ListMultimap- Returns:
- a new instance of a ListMultimap with the specified initial capacity
-
newListMultimap
Creates a new instance of a ListMultimap with the specified map type which is used to create the backed map for storing entries.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
mapType- the class of the map to be used to store entries- Returns:
- a new instance of a ListMultimap with the specified map type
-
newListMultimap
public static <K,E> ListMultimap<K,E> newListMultimap(Class<? extends Map> mapType, Class<? extends List> valueType) Creates a new instance of a ListMultimap with the specified map type which is used to create the backed map for storing entries and value type which is used to create the backed list for storing values.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
mapType- the class of the map to be used to store entriesvalueType- the class of the list to be used to store values- Returns:
- a new instance of a ListMultimap with the specified map type and value type
-
newListMultimap
public static <K,E> ListMultimap<K,E> newListMultimap(Supplier<? extends Map<K, List<E>>> mapSupplier, Supplier<? extends List<E>> valueSupplier) Creates a new instance of a ListMultimap with the specified map and value suppliers.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
mapSupplier- the supplier that provides the map to store entriesvalueSupplier- the supplier that provides the list to store values- Returns:
- a new instance of a ListMultimap with the specified map and value suppliers
-
newListMultimap
Creates a new instance of a ListMultimap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
m- the map whose elements are to be placed into this ListMultimap- Returns:
- a new instance of a ListMultimap containing the entries from the specified map
-
newListMultimap
public static <T,K> ListMultimap<K,T> newListMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyExtractor) Creates a new instance of a ListMultimap with the keys extracted from the specified collection by the specifiedFunctionand values from the specified collection.- Type Parameters:
T- the type of elements in the collectionK- the type of keys maintained by this map- Parameters:
c- the collection whose elements are to be placed into this ListMultimapkeyExtractor- the function to extract keys from the specified collection elements- Returns:
- a new instance of a ListMultimap with the keys extracted from the specified collection elements
-
newListMultimap
public static <T,K, ListMultimap<K,E> E> newListMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends E> valueExtractor) Creates a new instance of a ListMultimap with the keys and values extracted from the specified collection.- Type Parameters:
T- the type of elements in the collectionK- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
c- the collection whose elements are to be placed into this ListMultimapkeyExtractor- the function to extract keys from the collection elementsvalueExtractor- the function to extract values from the collection elements- Returns:
- a new instance of a ListMultimap with the keys and values extracted from the specified collection
-
newLinkedListMultimap
Creates a new instance of a ListMultimap backed by a LinkedHashMap.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Returns:
- a new instance of a ListMultimap backed by a LinkedHashMap
-
newLinkedListMultimap
Creates a new instance of a ListMultimap backed by a LinkedHashMap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
initialCapacity- the initial capacity of the ListMultimap- Returns:
- a new instance of a ListMultimap backed by a LinkedHashMap with the specified initial capacity
-
newLinkedListMultimap
Creates a new instance of a ListMultimap backed by a LinkedHashMap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
m- the map whose elements are to be placed into this ListMultimap- Returns:
- a new instance of a ListMultimap containing the entries from the specified map
-
newSortedListMultimap
Creates a new instance of a ListMultimap backed by a SortedMap. The keys in the map will be sorted according to their natural ordering.- Type Parameters:
K- the type of keys maintained by this map, which must be comparableE- the type of elements in the collection- Returns:
- a new instance of a ListMultimap backed by a SortedMap
-
newSortedListMultimap
public static <K extends Comparable<? super K>,E> ListMultimap<K,E> newSortedListMultimap(Map<? extends K, ? extends E> m) Creates a new instance of a ListMultimap backed by a SortedMap with the entries from the specified map. The keys in the map will be sorted according to their natural ordering.- Type Parameters:
K- the type of keys maintained by this map, which must be comparableE- the type of elements in the collection- Parameters:
m- the map whose elements are to be placed into this ListMultimap- Returns:
- a new instance of a ListMultimap containing the entries from the specified map
-
newSetMultimap
Creates a new instance of a SetMultimap.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Returns:
- a new instance of a SetMultimap
-
newSetMultimap
Creates a new instance of a SetMultimap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
initialCapacity- the initial capacity of the SetMultimap- Returns:
- a new instance of a SetMultimap with the specified initial capacity
-
newSetMultimap
Creates a new instance of a SetMultimap with the specified map type which is used to create the backed map for storing entries.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
mapType- the class of the map to be used to store entries- Returns:
- a new instance of a SetMultimap with the specified map type
-
newSetMultimap
public static <K,E> SetMultimap<K,E> newSetMultimap(Class<? extends Map> mapType, Class<? extends Set> valueType) Creates a new instance of a SetMultimap with the specified map type which is used to create the backed map for storing entries and value type which is used to create the backed Set for storing values.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
mapType- the class of the map to be used to store entriesvalueType- the class of the set to be used to store values- Returns:
- a new instance of a SetMultimap with the specified map type and value type
-
newSetMultimap
public static <K,E> SetMultimap<K,E> newSetMultimap(Supplier<? extends Map<K, Set<E>>> mapSupplier, Supplier<? extends Set<E>> valueSupplier) Creates a new instance of a SetMultimap with the specified map and value suppliers.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
mapSupplier- the supplier that provides the map to store entriesvalueSupplier- the supplier that provides the set to store values- Returns:
- a new instance of a SetMultimap with the specified map and value suppliers
-
newSetMultimap
Creates a new instance of a SetMultimap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
m- the map whose elements are to be placed into this SetMultimap- Returns:
- a new instance of a SetMultimap containing the entries from the specified map
-
newSetMultimap
public static <T,K> SetMultimap<K,T> newSetMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyExtractor) Creates a new instance of a SetMultimap with the keys extracted from the specified collection by the specifiedFunctionand values from the specified collection.- Type Parameters:
T- the type of elements in the collectionK- the type of keys maintained by this map- Parameters:
c- the collection whose elements are to be placed into this SetMultimapkeyExtractor- the function to extract keys from the specified collection elements- Returns:
- a new instance of a SetMultimap with the keys extracted from the specified collection elements
-
newSetMultimap
public static <T,K, SetMultimap<K,E> E> newSetMultimap(Collection<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends E> valueExtractor) Creates a new instance of a SetMultimap with the keys and values extracted from the specified collection.- Type Parameters:
T- the type of elements in the collectionK- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
c- the collection whose elements are to be placed into this SetMultimapkeyExtractor- the function to extract keys from the collection elementsvalueExtractor- the function to extract values from the collection elements- Returns:
- a new instance of a SetMultimap with the keys and values extracted from the specified collection
-
newLinkedSetMultimap
Creates a new instance of a SetMultimap backed by a LinkedHashMap.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Returns:
- a new instance of a SetMultimap backed by a LinkedHashMap
-
newLinkedSetMultimap
Creates a new instance of a SetMultimap backed by a LinkedHashMap with the specified initial capacity.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
initialCapacity- the initial capacity of the SetMultimap- Returns:
- a new instance of a SetMultimap backed by a LinkedHashMap with the specified initial capacity
-
newLinkedSetMultimap
Creates a new instance of a SetMultimap backed by a LinkedHashMap with the entries from the specified map.- Type Parameters:
K- the type of keys maintained by this mapE- the type of elements in the collection- Parameters:
m- the map whose elements are to be placed into this SetMultimap- Returns:
- a new instance of a SetMultimap containing the entries from the specified map
-
newSortedSetMultimap
Creates a new instance of a SetMultimap backed by a SortedMap. The keys in the map will be sorted according to their natural ordering.- Type Parameters:
K- the type of keys maintained by this map, which must be comparableE- the type of elements in the collection- Returns:
- a new instance of a SetMultimap backed by a SortedMap
-
newSortedSetMultimap
public static <K extends Comparable<? super K>,E> SetMultimap<K,E> newSortedSetMultimap(Map<? extends K, ? extends E> m) Creates a new instance of a SetMultimap backed by a SortedMap with the entries from the specified map. The keys in the map will be sorted according to their natural ordering.- Type Parameters:
K- the type of keys maintained by this map, which must be comparableE- the type of elements in the collection- Parameters:
m- the map whose elements are to be placed into this SetMultimap- Returns:
- a new instance of a SetMultimap containing the entries from the specified map
-
newEmptyDataSet
Creates a new empty DataSet. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. This method creates a DataSet with no rows or columns.- Returns:
- A new empty DataSet.
- See Also:
-
newEmptyDataSet
Creates a new empty DataSet with the specified column names. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. This method creates a DataSet with no rows, but with the specified column names.- Parameters:
columnNames- A collection of strings representing the names of the columns in the DataSet.- Returns:
- A new empty DataSet with the specified column names.
- See Also:
-
newEmptyDataSet
public static DataSet newEmptyDataSet(Collection<String> columnNames, Map<String, Object> properties) Creates a new empty DataSet with the specified column names and properties. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. This method creates a DataSet with no rows, but with the specified column names and properties.- Parameters:
columnNames- A collection of strings representing the names of the columns in the DataSet.properties- A map representing the properties of the DataSet. The keys are property names and the values are the corresponding property values.- Returns:
- A new empty DataSet with the specified column names and properties.
- See Also:
-
newDataSet
Creates a new DataSet with the specified rows. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. The rows parameter is a collection where each item represents a row in the DataSet.- Parameters:
rows- A collection of objects representing the data in the DataSet. Each object is a row which can be: Map/Bean.- Returns:
- A new DataSet with the specified rows.
- Throws:
IllegalArgumentException- If the provided rows do not align properly.- See Also:
-
newDataSet
public static DataSet newDataSet(Collection<?> rows, Map<String, Object> properties) throws IllegalArgumentExceptionCreates a new DataSet with the specified rows and properties. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. The rows parameter is a collection where each item represents a row in the DataSet. The properties parameter is a map where each entry represents a property of the DataSet.- Parameters:
rows- A collection of objects representing the data in the DataSet. Each object is a row which can be: Map/Bean.properties- A map of properties for the DataSet. Each key is a property name and each value is the property value.- Returns:
- A new DataSet with the specified rows and properties.
- Throws:
IllegalArgumentException- If the provided rows and properties do not align properly.- See Also:
-
newDataSet
public static DataSet newDataSet(Collection<String> columnNames, Collection<?> rows) throws IllegalArgumentException Creates a new DataSet with the specified column names and rows. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. Each item in the columnNames collection represents a column in the DataSet. The rows parameter is a collection where each item represents a row in the DataSet. The order of elements in each row should correspond to the order of column names.- Parameters:
columnNames- A collection of strings representing the names of the columns in the DataSet.rows- A collection of objects representing the data in the DataSet. Each object is a row which can be: Map/Bean/Array/List.- Returns:
- A new DataSet with the specified column names and rows.
- Throws:
IllegalArgumentException- If the length of columnNames is zero or not align with row list.- See Also:
-
newDataSet
public static DataSet newDataSet(Collection<String> columnNames, Collection<?> rows, Map<String, Object> properties) throws IllegalArgumentExceptionCreates a new DataSet with the specified column names, rows, and properties. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. Each item in the columnNames collection represents a column in the DataSet. The rows parameter is a collection where each item represents a row in the DataSet. The order of elements in each row should correspond to the order of column names. The properties parameter is a map where each entry represents a property of the DataSet.- Parameters:
columnNames- A collection of strings representing the names of the columns in the DataSet.rows- A collection of objects representing the data in the DataSet. Each object is a row which can be: Map/Bean/Array/List.properties- A map of properties for the DataSet. Each key is a property name and each value is the property value.- Returns:
- A new DataSet with the specified column names, rows, and properties.
- Throws:
IllegalArgumentException- If the length of columnNames is zero or not align with row list.- See Also:
-
newDataSet
public static DataSet newDataSet(Collection<String> columnNames, Object[][] rowList) throws IllegalArgumentException Creates a new DataSet with the specified column names and rows. The DataSet is a data structure that stores data in a tabular format, similar to a table in a database. Each item in the columnNames collection represents a column in the DataSet. The rowList parameter is a 2D array where each sub-array represents a row in the DataSet. The order of elements in each row should correspond to the order of column names.- Parameters:
columnNames- A collection of strings representing the names of the columns in the DataSet.rowList- A 2D array of objects representing the data in the DataSet. Each sub-array is a row.- Returns:
- A new DataSet with the specified column names and rows.
- Throws:
IllegalArgumentException- If the length of columnNames is zero or not equal to the length of the sub-arrays in rowList.- See Also:
-
newDataSet
Creates a new DataSet from the provided Map. The DataSet will have two columns: one for keys and one for values from the Map.- Parameters:
keyColumnName- The name of the column for the keys from the Map.valueColumnName- The name of the column for the values from the Map.m- The Map to convert into a DataSet.- Returns:
- A new DataSet with two columns: one for keys and one for values from the Map.
-
newDataSet
Creates a new DataSet from the provided Map. The DataSet will have as many columns as there are entries in the Map. The column names are the keys from the Map. Each column corresponds to a Collection in the Map. If a column has fewer rows than the maximum number of rows, the missing rows will be filled withnullvalues. Eventually all the columns will have the same number of rows.- Type Parameters:
C- The type of the Collection values in the Map.- Parameters:
map- The Map to convert into a DataSet. The keys of the map represent the column names and the values (which are collections) represent the data in the columns.- Returns:
- A new DataSet with columns created from the Map.
-
newDataSet
public static DataSet newDataSet(String columnName, Collection<?> column) throws IllegalArgumentException Creates a new DataSet with single column from the provided Collection. The DataSet will have one column with the provided column name. The data in the column is the data from the provided Collection.- Parameters:
columnName- The name of the column in the DataSet.column- The Collection to convert into a DataSet column.- Returns:
- A new DataSet with one column containing the data from the provided Collection.
- Throws:
IllegalArgumentException- if the provided columnName is empty.
-
merge
Merges two given DataSets into a single DataSet.- Parameters:
a- The first DataSet to be merged.b- The second DataSet to be merged.- Returns:
- A new DataSet which is the result of merging DataSet a and DataSet b.
- Throws:
IllegalArgumentException- if either a or b isnull.
-
merge
public static DataSet merge(@NotNull DataSet a, @NotNull DataSet b, @NotNull DataSet c) throws IllegalArgumentException Merges three given DataSets into a single DataSet.- Parameters:
a- The first DataSet to be merged.b- The second DataSet to be merged.c- The third DataSet to be merged.- Returns:
- A new DataSet which is the result of merging DataSet a, b and c.
- Throws:
IllegalArgumentException- if either a, b or c isnull.
-
merge
Merges a collection of DataSets into a single DataSet.- Parameters:
dss- The collection of DataSets to be merged.- Returns:
- A new DataSet which is the result of merging all the DataSets in the provided collection.
- Throws:
IllegalArgumentException- if the provided collection isnull.
-
merge
public static DataSet merge(Collection<? extends DataSet> dss, boolean requiresSameColumns) throws IllegalArgumentException Merges a collection of DataSets into a single DataSet.- Parameters:
dss- The collection of DataSets to be merged.requiresSameColumns- A boolean flag that indicates whether the DataSets in the collection should have the same columns. If set totrue, all DataSets in the collection must have the same columns. If set tofalse, the DataSets in the collection can have different columns.- Returns:
- A new DataSet which is the result of merging all the DataSets in the provided collection.
- Throws:
IllegalArgumentException- if the provided collection isnullorrequiresSameColumnsistrueand theDataSetsindssdon't have the same the same column names.
-
toArray
Converts the specified collection to an array. Returns an empty array if the specified collection isnullor empty.- Parameters:
c- the collection to be converted to an array- Returns:
- an array containing all the elements in the specified collection
-
toArray
public static Object[] toArray(Collection<?> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range in the specified collection into an array.- Parameters:
c- The collection to be converted into an array.fromIndex- The starting (inclusive) index of the range to be converted.toIndex- The ending (exclusive) index of the range to be converted.- Returns:
- An array containing the elements of the specified range of the collection.
- Throws:
IndexOutOfBoundsException- if the provided indices are out of the collection's range.
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, @NotNull A[] a) throws IndexOutOfBoundsException, IllegalArgumentException Converts a collection into an array. If the provided array is large enough to hold the elements of the collection, it is filled with the collection's elements, otherwise, a new array of the same runtime type is allocated for this purpose.- Type Parameters:
A- The type of the array.T- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c- The collection to be converted into an array.a- The array into which the elements of the collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.- Returns:
- The array containing the elements of the collection. If the provided array was large enough to hold the collection's elements, it is the same as the provided array.
- Throws:
IllegalArgumentException- if the specifiedArrayisnull.IndexOutOfBoundsException
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, int fromIndex, int toIndex, @NotNull A[] a) throws IllegalArgumentException Converts the specified range in the specified collection into an array. If the provided array is large enough to hold the elements of the collection, it is filled with the collection's elements, otherwise, a new array of the same runtime type is allocated for this purpose.- Type Parameters:
A- The type of the array.T- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c- The collection to be converted into an array.fromIndex- The starting (inclusive) index of the range to be converted.toIndex- The ending (exclusive) index of the range to be converted.a- The array into which the elements of the collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.- Returns:
- The array containing the elements of the specified portion of the collection. If the provided array was large enough to hold the collection's elements, it is the same as the provided array.
- Throws:
IllegalArgumentException- if the specifiedArrayisnull.
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, IntFunction<A[]> arraySupplier) Converts a collection into an array using a provided array supplier function. The array supplier function is responsible for creating a new array of the appropriate type and size.- Type Parameters:
A- The type of the array.T- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c- The collection to be converted into an array.arraySupplier- The function to generate a new array of the appropriate type and size.
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, int fromIndex, int toIndex, IntFunction<A[]> arraySupplier) throws IndexOutOfBoundsException Converts the specified range in the specified collection into an array using a provided array supplier function. The array supplier function is responsible for creating a new array of the appropriate type and size.- Type Parameters:
A- The type of the array.T- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c- The collection to be converted into an array.fromIndex- The starting (inclusive) index of the portion to be converted.toIndex- The ending (exclusive) index of the portion to be converted.arraySupplier- The function to generate a new array of the appropriate type and size.- Returns:
- The array containing the elements of the specified portion of the collection.
- Throws:
IndexOutOfBoundsException- if the specifiedfromIndexortoIndexis out of the collection's range.
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, @NotNull Class<A[]> targetType) throws IndexOutOfBoundsException, IllegalArgumentException Converts a collection into an array of a specified type.- Type Parameters:
A- The type of the array.T- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c- The collection to be converted into an array.targetType- The Class object representing the type of the array to be returned.- Returns:
- The array containing the elements of the collection.
- Throws:
IllegalArgumentException- if the specifiedClassisnull.IndexOutOfBoundsException
-
toArray
public static <A,T extends A> A[] toArray(Collection<? extends T> c, int fromIndex, int toIndex, @NotNull Class<A[]> targetType) throws IllegalArgumentException Converts the specified range in the specified collection into an array of a specified type.- Type Parameters:
A- The type of the array.T- The type of the elements in the collection. It must extend or be the same as the type of the array.- Parameters:
c- The collection to be converted into an array.fromIndex- The starting (inclusive) index of the range to be converted.toIndex- The ending (exclusive) index of the range to be converted.targetType- The Class object representing the type of the array to be returned.- Returns:
- The array containing the elements of the specified portion of the collection.
- Throws:
IllegalArgumentException- if the specifiedClassisnull.IndexOutOfBoundsException- if the specifiedfromIndexortoIndexis out of the collection's range.
-
toBooleanArray
Converts a collection of Boolean objects to a boolean array.- Parameters:
c- the collection of Boolean objects to be converted- Returns:
- a boolean array containing the primitive boolean values from the collection
-
toBooleanArray
Converts the specified range of the specified Boolean collection to a boolean array.- Parameters:
c- the collection of Boolean objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a boolean array containing the primitive boolean values from the specified range of the collection
-
toBooleanArray
Converts a collection of Boolean objects to a boolean array.- Parameters:
c- the collection of Boolean objects to be converteddefaultForNull- the default boolean value to use if a Boolean object in the collection is null- Returns:
- a boolean array containing the primitive boolean values from the collection
-
toBooleanArray
public static boolean[] toBooleanArray(Collection<Boolean> c, int fromIndex, int toIndex, boolean defaultForNull) throws IndexOutOfBoundsException Converts the specified range of the specified Boolean collection to a boolean array.- Parameters:
c- the collection of Boolean objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converteddefaultForNull- the default boolean value to use if a Boolean object in the collection is null- Returns:
- a boolean array containing the primitive boolean values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toBooleanArray
public static boolean[] toBooleanArray(byte[] a) Converts a byte array to a boolean array. Each byte with positive value(> 0) is converted to a boolean valuetrue,0and negative value tofalse.- Parameters:
a- the byte array to be converted- Returns:
- a boolean array with the same length as the input array, or an empty boolean array if the input array is
nullor empty
-
toBooleanArray
public static boolean[] toBooleanArray(int[] a) Converts an integer array to a boolean array. Each integer with positive value(> 0) is converted to a boolean valuetrue,0and negative value tofalse.- Parameters:
a- the integer array to be converted- Returns:
- a boolean array with the same length as the input array, or an empty boolean array if the input array is
nullor empty
-
toCharArray
Converts a collection of Character objects to a char array.- Parameters:
c- the collection of Character objects to be converted- Returns:
- a char array containing the primitive char values from the collection
-
toCharArray
Converts the specified range of the specified character collection to a char array.- Parameters:
c- the collection of Character objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a char array containing the primitive char values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toCharArray
Converts a collection of Character objects to a char array.- Parameters:
c- the collection of Character objects to be converteddefaultForNull- the default char value to use if a Character object in the collection is null- Returns:
- a char array containing the primitive char values from the collection
-
toCharArray
public static char[] toCharArray(Collection<Character> c, int fromIndex, int toIndex, char defaultForNull) throws IndexOutOfBoundsException Converts the specified range of the specified character collection to a char array.- Parameters:
c- the collection of Character objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converteddefaultForNull- the default char value to use if a Character object in the collection is null- Returns:
- a char array containing the primitive char values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toByteArray
Converts a collection of Number objects to a byte array.- Parameters:
c- the collection of Number objects to be converted- Returns:
- a byte array containing the primitive byte values from the collection
-
toByteArray
Converts the specified range of the specified Number collection to a byte array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a byte array containing the primitive byte values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toByteArray
Converts a collection of Number objects to a byte array.- Parameters:
c- the collection of Number objects to be converteddefaultForNull- the default byte value to use if a Number object in the collection is null- Returns:
- a byte array containing the primitive byte values from the collection
-
toByteArray
public static byte[] toByteArray(Collection<? extends Number> c, int fromIndex, int toIndex, byte defaultForNull) throws IndexOutOfBoundsException Converts the specified range of the specified Number collection to a byte array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converteddefaultForNull- the default byte value to use if a Number object in the collection is null- Returns:
- a byte array containing the primitive byte values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toByteArray
public static byte[] toByteArray(boolean[] a) Converts a boolean array to a byte array. Each boolean value is converted to a byte value:trueto 1 andfalseto 0.- Parameters:
a- the boolean array to be converted- Returns:
- a byte array with the same length as the input array, or an empty byte array if the input array is
nullor empty
-
toShortArray
Converts a collection of Number objects to a short array.- Parameters:
c- the collection of Number objects to be converted- Returns:
- a short array containing the primitive short values from the collection
-
toShortArray
Converts the specified range of the specified Number collection to a short array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a short array containing the primitive short values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toShortArray
Converts a collection of Number objects to a short array.- Parameters:
c- the collection of Number objects to be converteddefaultForNull- the default short value to use if a Number object in the collection is null- Returns:
- a short array containing the primitive short values from the collection
-
toShortArray
public static short[] toShortArray(Collection<? extends Number> c, int fromIndex, int toIndex, short defaultForNull) throws IndexOutOfBoundsException Converts the specified range of the specified Number collection to a short array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converteddefaultForNull- the default short value to use if a Number object in the collection is null- Returns:
- a short array containing the primitive short values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toIntArray
Converts a collection of Number objects to an int array.- Parameters:
c- the collection of Number objects to be converted- Returns:
- an int array containing the primitive int values from the collection
-
toIntArray
Converts the specified range of the specified Number collection to an int array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- an int array containing the primitive int values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toIntArray
Converts a collection of Number objects to an int array.- Parameters:
c- the collection of Number objects to be converteddefaultForNull- the default int value to use if a Number object in the collection is null- Returns:
- an int array containing the primitive int values from the collection
-
toIntArray
public static int[] toIntArray(Collection<? extends Number> c, int fromIndex, int toIndex, int defaultForNull) throws IndexOutOfBoundsException Converts the specified range of the specified Number collection to an int array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converteddefaultForNull- the default int value to use if a Number object in the collection is null- Returns:
- an int array containing the primitive int values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toIntArray
public static int[] toIntArray(char[] a) Converts a char array to an int array. Each char value is converted to its corresponding int value.- Parameters:
a- the char array to be converted- Returns:
- an int array with the same length as the input array, or an empty byte array if the input array is
nullor empty
-
toIntArray
public static int[] toIntArray(boolean[] a) Converts a boolean array to an int array. Each boolean value is converted to an int value:trueto 1 andfalseto 0.- Parameters:
a- the boolean array to be converted- Returns:
- an int array with the same length as the input array, or an empty byte array if the input array is
nullor empty
-
toLongArray
Converts a collection of Number objects to a long array.- Parameters:
c- the collection of Number objects to be converted- Returns:
- a long array containing the primitive long values from the collection
-
toLongArray
Converts the specified range of the specified Number collection to a long array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a long array containing the primitive long values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toLongArray
Converts a collection of Number objects to a long array.- Parameters:
c- the collection of Number objects to be converteddefaultForNull- the default long value to use if a Number object in the collection is null- Returns:
- a long array containing the primitive long values from the collection
-
toLongArray
public static long[] toLongArray(Collection<? extends Number> c, int fromIndex, int toIndex, long defaultForNull) throws IndexOutOfBoundsException Converts the specified range of the specified Number collection to a long array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converteddefaultForNull- the default long value to use if a Number object in the collection is null- Returns:
- a long array containing the primitive long values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toFloatArray
Converts a collection of Number objects to a float array.- Parameters:
c- the collection of Number objects to be converted- Returns:
- a float array containing the primitive float values from the collection
-
toFloatArray
Converts the specified range of the specified Number collection to a float array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a float array containing the primitive float values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toFloatArray
Converts a collection of Number objects to a float array.- Parameters:
c- the collection of Number objects to be converteddefaultForNull- the default float value to use if a Number object in the collection is null- Returns:
- a float array containing the primitive float values from the collection
-
toFloatArray
public static float[] toFloatArray(Collection<? extends Number> c, int fromIndex, int toIndex, float defaultForNull) throws IndexOutOfBoundsException Converts the specified range of the specified Number collection to a float array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converteddefaultForNull- the default float value to use if a Number object in the collection is null- Returns:
- a float array containing the primitive float values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toDoubleArray
Converts a collection of Number objects to a double array.- Parameters:
c- the collection of Number objects to be converted- Returns:
- a double array containing the primitive double values from the collection
-
toDoubleArray
Converts the specified range of the specified Number collection to a double array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a double array containing the primitive double values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toDoubleArray
Converts a collection of Number objects to a double array.- Parameters:
c- the collection of Number objects to be converteddefaultForNull- the default double value to use if a Number object in the collection is null- Returns:
- a double array containing the primitive double values from the collection
-
toDoubleArray
public static double[] toDoubleArray(Collection<? extends Number> c, int fromIndex, int toIndex, double defaultForNull) throws IndexOutOfBoundsException Converts the specified range of the specified Number collection to a double array.- Parameters:
c- the collection of Number objects to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converteddefaultForNull- the default double value to use if a Number object in the collection is null- Returns:
- a double array containing the primitive double values from the specified range of the collection
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the collection's range
-
toList
Converts a boolean array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the boolean array to be converted- Returns:
- a modifiable List of Boolean objects containing the values from the boolean array
-
toList
public static List<Boolean> toList(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the boolean array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of Boolean objects containing the values from the specified range of the boolean array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts a char array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the char array to be converted- Returns:
- a modifiable List of Character objects containing the values from the char array
-
toList
public static List<Character> toList(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the char array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of Character objects containing the values from the specified range of the char array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts a byte array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the byte array to be converted- Returns:
- a modifiable List of Byte objects containing the values from the byte array
-
toList
public static List<Byte> toList(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the byte array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the byte array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of Byte objects containing the values from the specified range of the byte array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts a short array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the short array to be converted- Returns:
- a modifiable List of Short objects containing the values from the short array
-
toList
public static List<Short> toList(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the short array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the short array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of Short objects containing the values from the specified range of the short array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts an int array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the int array to be converted- Returns:
- a modifiable List of Integer objects containing the values from the int array
-
toList
public static List<Integer> toList(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the int array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the int array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of Integer objects containing the values from the specified range of the int array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts a long array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the long array to be converted- Returns:
- a modifiable List of Long objects containing the values from the long array
-
toList
public static List<Long> toList(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the long array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the long array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of Long objects containing the values from the specified range of the long array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts a float array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the float array to be converted- Returns:
- a modifiable List of Float objects containing the values from the float array
-
toList
public static List<Float> toList(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the float array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the float array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of Float objects containing the values from the specified range of the float array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts a double array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the double array to be converted- Returns:
- a modifiable List of Double objects containing the values from the double array
-
toList
public static List<Double> toList(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the double array to a modifiable List, which is NOT backed with the input array- Parameters:
a- the double array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of Double objects containing the values from the specified range of the double array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts an array of objects to a modifiable List, which is NOT backed with the input array.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be converted- Returns:
- a modifiable List of objects containing the values from the array
-
toList
public static <T> List<T> toList(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the array to a modifiable List, which is NOT backed with the input array.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable List of objects containing the values from the specified range of the array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toList
Converts an Iterator of objects to a modifiable List.- Type Parameters:
T- the type of elements in the iterator- Parameters:
iter- the iterator to be converted- Returns:
- a modifiable List of objects containing the values from the iterator
-
toSet
Converts a boolean array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the boolean array to be converted- Returns:
- a modifiable Set of Boolean objects containing the values from the boolean array
-
toSet
public static Set<Boolean> toSet(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the boolean array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the boolean array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of Boolean objects containing the values from the specified range of the boolean array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts a char array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the char array to be converted- Returns:
- a modifiable Set of Character objects containing the values from the char array
-
toSet
public static Set<Character> toSet(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the char array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the char array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of Character objects containing the values from the specified range of the char array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts a byte array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the byte array to be converted- Returns:
- a modifiable Set of Byte objects containing the values from the byte array
-
toSet
public static Set<Byte> toSet(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the byte array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the byte array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of Byte objects containing the values from the specified range of the byte array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts a short array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the short array to be converted- Returns:
- a modifiable Set of Short objects containing the values from the short array
-
toSet
public static Set<Short> toSet(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the short array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the short array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of Short objects containing the values from the specified range of the short array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts an int array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the int array to be converted- Returns:
- a modifiable Set of Integer objects containing the values from the int array
-
toSet
public static Set<Integer> toSet(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the int array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the int array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of Integer objects containing the values from the specified range of the int array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts a long array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the long array to be converted- Returns:
- a modifiable Set of Long objects containing the values from the long array
-
toSet
public static Set<Long> toSet(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the long array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the long array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of Long objects containing the values from the specified range of the long array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts a float array to a Set of, which is NOT backed with the input array.- Parameters:
a- the float array to be converted- Returns:
- a modifiable Set of Float objects containing the values from the float array
-
toSet
public static Set<Float> toSet(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the float array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the float array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of Float objects containing the values from the specified range of the float array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts a double array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the double array to be converted- Returns:
- a modifiable Set of Double objects containing the values from the double array
-
toSet
public static Set<Double> toSet(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Converts the specified range of the double array to a modifiable Set, which is NOT backed with the input array.- Parameters:
a- the double array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of Double objects containing the values from the specified range of the double array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts an array of objects to a modifiable Set, which is NOT backed with the input array.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be converted- Returns:
- a modifiable Set of objects containing the values from the array
-
toSet
Converts the specified range of the array to a modifiable Set, which is NOT backed with the input array.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be converted- Returns:
- a modifiable Set of objects containing the values from the specified range of the array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range
-
toSet
Converts an Iterator of objects to a modifiable Set.- Type Parameters:
T- the type of elements in the iterator- Parameters:
iter- the iterator to be converted- Returns:
- a modifiable Set of objects containing the values from the iterator
-
toCollection
public static <C extends Collection<Boolean>> C toCollection(boolean[] a, IntFunction<? extends C> supplier) Converts a boolean array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the boolean array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Boolean objects containing the values from the boolean array
- See Also:
-
toCollection
public static <C extends Collection<Boolean>> C toCollection(boolean[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the boolean array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the boolean array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Boolean objects containing the values from the specified range of the boolean array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range- See Also:
-
toCollection
public static <C extends Collection<Character>> C toCollection(char[] a, IntFunction<? extends C> supplier) Converts a char array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the char array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Character objects containing the values from the char array
- See Also:
-
toCollection
public static <C extends Collection<Character>> C toCollection(char[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the char array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the char array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Character objects containing the values from the specified range of the char array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range- See Also:
-
toCollection
public static <C extends Collection<Byte>> C toCollection(byte[] a, IntFunction<? extends C> supplier) Converts a byte array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the byte array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Byte objects containing the values from the byte array
- See Also:
-
toCollection
public static <C extends Collection<Byte>> C toCollection(byte[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the byte array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the byte array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Byte objects containing the values from the specified range of the byte array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range- See Also:
-
toCollection
public static <C extends Collection<Short>> C toCollection(short[] a, IntFunction<? extends C> supplier) Converts a short array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the short array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Short objects containing the values from the short
- See Also:
-
toCollection
public static <C extends Collection<Short>> C toCollection(short[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the short array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the short array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Short objects containing the values from the specified range of the short array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's- See Also:
-
toCollection
public static <C extends Collection<Integer>> C toCollection(int[] a, IntFunction<? extends C> supplier) Converts an int array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the int array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Integer objects containing the values from the int array
- See Also:
-
toCollection
public static <C extends Collection<Integer>> C toCollection(int[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the int array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the int array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Integer objects containing the values from the specified range of the int array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range- See Also:
-
toCollection
public static <C extends Collection<Long>> C toCollection(long[] a, IntFunction<? extends C> supplier) Converts a long array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the long array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Long objects containing the values from the long array
- See Also:
-
toCollection
public static <C extends Collection<Long>> C toCollection(long[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the long array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the long array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Long objects containing the values from the specified range of the long array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's- See Also:
-
toCollection
public static <C extends Collection<Float>> C toCollection(float[] a, IntFunction<? extends C> supplier) Converts a float array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the float array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Float objects containing the values from the float array
- See Also:
-
toCollection
public static <C extends Collection<Float>> C toCollection(float[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the float array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the float array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Float objects containing the values from the specified range of the float array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range- See Also:
-
toCollection
public static <C extends Collection<Double>> C toCollection(double[] a, IntFunction<? extends C> supplier) Converts a double array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the double array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Double objects containing the values from the double array
- See Also:
-
toCollection
public static <C extends Collection<Double>> C toCollection(double[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the double array to a specified type of Collection.- Type Parameters:
C- the type of Collection to be returned- Parameters:
a- the double array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of Double objects containing the values from the specified range of the double array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range- See Also:
-
toCollection
Converts an array of objects to a specified type of Collection.- Type Parameters:
T- the type of elements in the array and the CollectionC- the type of Collection to be returned- Parameters:
a- the array to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of objects containing the values from the array
- See Also:
-
toCollection
public static <T,C extends Collection<T>> C toCollection(T[] a, int fromIndex, int toIndex, IntFunction<? extends C> supplier) throws IndexOutOfBoundsException Converts the specified range of the array to a specified type of Collection.- Type Parameters:
T- the type of elements in the array and the CollectionC- the type of Collection to be returned- Parameters:
a- the array to be convertedfromIndex- the starting (inclusive) index of the range to be convertedtoIndex- the ending (exclusive) index of the range to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of objects containing the values from the specified range of the array
- Throws:
IndexOutOfBoundsException- if the specified indices are out of the array's range- See Also:
-
toCollection
public static <T,C extends Collection<T>> C toCollection(Iterable<? extends T> c, IntFunction<? extends C> supplier) Converts an Iterable to a specified type of Collection.- Type Parameters:
T- the type of elements in the Iterable and the CollectionC- the type of Collection to be returned- Parameters:
c- the Iterable to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of objects containing the values from the Iterable
- See Also:
-
toCollection
public static <T,C extends Collection<T>> C toCollection(Iterator<? extends T> iter, Supplier<? extends C> supplier) Converts an Iterator to a specified type of Collection.- Type Parameters:
T- the type of elements in the Iterator and the CollectionC- the type of Collection to be returned- Parameters:
iter- the Iterator to be convertedsupplier- a function that provides a new instance of the desired Collection type- Returns:
- a Collection of objects containing the values from the Iterator
- See Also:
-
toMap
public static <T,K> Map<K,T> toMap(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor) Converts an Iterable to a Map using a key extractor function.- Type Parameters:
T- the type of elements in the IterableK- the type of keys in the resulting Map- Parameters:
c- the Iterable to be convertedkeyExtractor- a function that extracts keys from the elements of the Iterable- Returns:
- a Map containing the elements of the Iterable, with keys extracted by the keyExtractor function
-
toMap
public static <T,K, Map<K,V> V> toMap(Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor) Converts an Iterable to a Map using key and value extractor functions.- Type Parameters:
T- the type of elements in the IterableK- the type of keys in the resulting MapV- the type of values in the resulting Map- Parameters:
c- the Iterable to be convertedkeyExtractor- a function that extracts keys from the elements of the IterablevalueExtractor- a function that extracts values from the elements of the Iterable- Returns:
- a Map containing the elements of the Iterable, with keys and values extracted by the keyExtractor and valueExtractor functions
-
toMap
public static <T,K, M toMapV, M extends Map<K, V>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, IntFunction<? extends M> mapSupplier) Converts an Iterable to a Map using key and value extractor functions, with a custom Map supplier.- Type Parameters:
T- the type of elements in the IterableK- the type of keys in the resulting MapV- the type of values in the resulting MapM- the type of Map to be returned- Parameters:
c- the Iterable to be convertedkeyExtractor- a function that extracts keys from the elements of the IterablevalueExtractor- a function that extracts values from the elements of the IterablemapSupplier- a function that provides a new instance of the desired Map type- Returns:
- a Map containing the elements of the Iterable, with keys and values extracted by the keyExtractor and valueExtractor functions
-
toMap
public static <T,K, M toMapV, M extends Map<K, V>> (Iterable<? extends T> c, Function<? super T, ? extends K> keyExtractor, Function<? super T, ? extends V> valueExtractor, BiFunction<? super V, ? super V, ? extends V> mergeFunction, IntFunction<? extends M> mapSupplier) Converts an Iterable to a Map using key and value extractor functions, with a custom Map supplier.- Type Parameters:
T- the type of elements in the IterableK- the type of keys in the resulting MapV- the type of values in the resulting MapM- the type of Map to be returned- Parameters:
c- the Iterable to be convertedkeyExtractor- a function that extracts keys from the elements of the IterablevalueExtractor- a function that extracts values from the elements of the IterablemapSupplier- a function that provides a new instance of the desired Map type- Returns:
- a Map containing the elements of the Iterable, with keys and values extracted by the keyExtractor and valueExtractor functions
-
toMap
Converts an Iterator to a Map using a key extractor function.- Type Parameters:
T- the type of elements in the IteratorK- the type of keys in the resulting Map- Parameters:
iter- the Iterator to be convertedkeyExtractor- a function that extracts keys from the elements of the Iterator- Returns:
- a Map containing the elements of the Iterator, with keys extracted by the keyExtractor function
-
toMap
public static <T,K, Map<K,V> V> toMap(Iterator<? extends T> iter, Function<? super T, K> keyExtractor, Function<? super T, ? extends V> valueExtractor) Converts an Iterator to a Map using key and value extractor functions.- Type Parameters:
T- the type of elements in the IteratorK- the type of keys in the resulting MapV- the type of values in the resulting Map- Parameters:
iter- the Iterator to be convertedkeyExtractor- a function that extracts keys from the elements of the IteratorvalueExtractor- a function that extracts values from the elements of the Iterator- Returns:
- a Map containing the elements of the Iterator, with keys and values extracted by the keyExtractor and valueExtractor functions
-
toMap
public static <T,K, M toMapV, M extends Map<K, V>> (Iterator<? extends T> iter, Function<? super T, K> keyExtractor, Function<? super T, ? extends V> valueExtractor, Supplier<? extends M> mapSupplier) Converts an Iterator to a Map using key and value extractor functions, with a custom Map supplier.- Type Parameters:
T- the type of elements in the IteratorK- the type of keys in the resulting MapV- the type of values in the resulting MapM- the type of Map to be returned- Parameters:
iter- the Iterator to be convertedkeyExtractor- a function that extracts keys from the elements of the IteratorvalueExtractor- a function that extracts values from the elements of the IteratormapSupplier- a function that provides a new instance of the desired Map type- Returns:
- a Map containing the elements of the Iterator, with keys and values extracted by the keyExtractor and valueExtractor functions
-
toMap
public static <T,K, M toMapV, M extends Map<K, V>> (Iterator<? extends T> iter, Function<? super T, K> keyExtractor, Function<? super T, ? extends V> valueExtractor, BiFunction<? super V, ? super V, ? extends V> mergeFunction, Supplier<? extends M> mapSupplier) Converts an Iterator to a Map using key and value extractor functions, with a custom Map supplier.- Type Parameters:
T- the type of elements in the IteratorK- the type of keys in the resulting MapV- the type of values in the resulting MapM- the type of Map to be returned- Parameters:
iter- the Iterator to be convertedkeyExtractor- a function that extracts keys from the elements of the IteratorvalueExtractor- a function that extracts values from the elements of the IteratormergeFunction- a function that merges values if the same key is encounteredmapSupplier- a function that provides a new instance of the desired Map type- Returns:
- a Map containing the elements of the Iterator, with keys and values extracted by the keyExtractor and valueExtractor functions
-
asArray
Returns the input array as is.- Type Parameters:
T- the type of the array elements- Parameters:
a- the input array- Returns:
- the input array
-
asMap
Returns a modifiableMapwith the specified key and value.- Type Parameters:
K- the type of keys in the MapV- the type of values in the Map- Parameters:
k1- the key to be placed in the Mapv1- the value to be associated with the key in the Map- Returns:
- a Map containing the specified key and value
-
asMap
Returns a modifiableMapwith the specified keys and values.- Type Parameters:
K- the type of keys in the MapV- the type of values in the Map- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Map- Returns:
- a Map containing the specified keys and values
-
asMap
Returns a modifiableMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Map- Returns:
- a Map containing the specified keys and values
-
asMap
Returns a modifiableMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Mapk4- the fourth key to be placed in the Mapv4- the value to be associated with the fourth key in the Map- Returns:
- a Map containing the specified keys and values
-
asMap
Returns a modifiableMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Mapk4- the fourth key to be placed in the Mapv4- the value to be associated with the fourth key in the Mapk5- the fifth key to be placed in the Mapv5- the value to be associated with the fifth key in the Map- Returns:
- a Map containing the specified keys and values
-
asMap
public static <K,V> Map<K,V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a modifiableMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Mapk4- the fourth key to be placed in the Mapv4- the value to be associated with the fourth key in the Mapk5- the fifth key to be placed in the Mapv5- the value to be associated with the fifth key in the Mapk6- the sixth key to be placed in the Mapv6- the value to be associated with the sixth key in the Map- Returns:
- a Map containing the specified keys and values
-
asMap
public static <K,V> Map<K,V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a modifiableMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Mapk4- the fourth key to be placed in the Mapv4- the value to be associated with the fourth key in the Mapk5- the fifth key to be placed in the Mapv5- the value to be associated with the fifth key in the Mapk6- the sixth key to be placed in the Mapv6- the value to be associated with the sixth key in the Mapk7- the seventh key to be placed in the Mapv7- the value to be associated with the seventh key in the Map- Returns:
- a Map containing the specified keys and values
-
asMap
Deprecated.Returns a modifiableMapwith specified key/value pairs.- Type Parameters:
K- the key typeV- the value type- Parameters:
a- an array of key/value pairs- Returns:
- a Map containing the specified key/value pairs
-
asLinkedHashMap
Returns a modifiableLinkedHashMapwith specified key and value.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Map- Returns:
- a Map containing the specified keys and values
-
asLinkedHashMap
Returns a modifiableLinkedHashMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Map- Returns:
- a Map containing the specified keys and values
-
asLinkedHashMap
Returns a modifiableLinkedHashMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Map- Returns:
- a Map containing the specified keys and values
-
asLinkedHashMap
Returns a modifiableLinkedHashMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Mapk4- the fourth key to be placed in the Mapv4- the value to be associated with the fourth key in the Map- Returns:
- a Map containing the specified keys and values
-
asLinkedHashMap
public static <K,V> Map<K,V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns a modifiableLinkedHashMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Mapk4- the fourth key to be placed in the Mapv4- the value to be associated with the fourth key in the Mapk5- the fifth key to be placed in the Mapv5- the value to be associated with the fifth key in the Map- Returns:
- a Map containing the specified keys and values
-
asLinkedHashMap
public static <K,V> Map<K,V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a modifiableLinkedHashMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Mapk4- the fourth key to be placed in the Mapv4- the value to be associated with the fourth key in the Mapk5- the fifth key to be placed in the Mapv5- the value to be associated with the fifth key in the Mapk6- the sixth key to be placed in the Mapv6- the value to be associated with the sixth key in the Map- Returns:
- a Map containing the specified keys and values
-
asLinkedHashMap
public static <K,V> Map<K,V> asLinkedHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a modifiableLinkedHashMapwith specified keys/values.- Type Parameters:
K- the key typeV- the value type- Parameters:
k1- the first key to be placed in the Mapv1- the value to be associated with the first key in the Mapk2- the second key to be placed in the Mapv2- the value to be associated with the second key in the Mapk3- the third key to be placed in the Mapv3- the value to be associated with the third key in the Mapk4- the fourth key to be placed in the Mapv4- the value to be associated with the fourth key in the Mapk5- the fifth key to be placed in the Mapv5- the value to be associated with the fifth key in the Mapk6- the sixth key to be placed in the Mapv6- the value to be associated with the sixth key in the Mapk7- the seventh key to be placed in the Mapv7- the value to be associated with the seventh key in the Map- Returns:
- a Map containing the specified keys and values
-
asLinkedHashMap
Deprecated.Returns a modifiableLinkedHashMapwith specified key/value pairs.- Type Parameters:
K- the key typeV- the value type- Parameters:
a- an array of key/value pairs- Returns:
- a Map containing the specified key/value pairs
-
asProps
Returns a modifiableMapwith a specified key/value.- Parameters:
propName- the name of the property to be placed in the MappropValue- the value to be associated with the property name in the Map- Returns:
- a Map containing the specified property name and value
-
asProps
public static Map<String,Object> asProps(String propName1, Object propValue1, String propName2, Object propValue2) Returns a modifiableMapwith specified keys/values.- Parameters:
propName1- the first property name to be placed in the MappropValue1- the value to be associated with the first property name in the MappropName2- the second property name to be placed in the MappropValue2- the value to be associated with the second property name in the Map- Returns:
- a Map containing the specified property names and values
-
asProps
public static Map<String,Object> asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3) Returns a modifiableMapwith specified keys/values.- Parameters:
propName1- the first property name to be placed in the MappropValue1- the value to be associated with the first property name in the MappropName2- the second property name to be placed in the MappropValue2- the value to be associated with the second property name in the MappropName3- the third property name to be placed in the MappropValue3- the value to be associated with the third property name in the Map- Returns:
- a Map containing the specified property names and values
-
asProps
public static Map<String,Object> asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3, String propName4, Object propValue4) Returns a modifiableMapwith specified keys/values.- Parameters:
propName1- the first property name to be placed in the MappropValue1- the value to be associated with the first property name in the MappropName2- the second property name to be placed in the MappropValue2- the value to be associated with the second property name in the MappropName3- the third property name to be placed in the MappropValue3- the value to be associated with the third property name in the MappropName4- the fourth property name to be placed in the MappropValue4- the value to be associated with the fourth property name in the Map- Returns:
- a Map containing the specified property names and values
-
asProps
public static Map<String,Object> asProps(String propName1, Object propValue1, String propName2, Object propValue2, String propName3, Object propValue3, String propName4, Object propValue4, String propName5, Object propValue5) Returns a modifiableMapwith specified keys/values.- Parameters:
propName1- the first property name to be placed in the MappropValue1- the value to be associated with the first property name in the MappropName2- the second property name to be placed in the MappropValue2- the value to be associated with the second property name in the MappropName3- the third property name to be placed in the MappropValue3- the value to be associated with the third property name in the MappropName4- the fourth property name to be placed in the MappropValue4- the value to be associated with the fourth property name in the MappropName5- the fifth property name to be placed in the MappropValue5- the value to be associated with the fifth property name in the Map- Returns:
- a Map containing the specified property names and values
-
asProps
Deprecated.Returns a modifiableMapwith specified key/value pairs.- Parameters:
a- an array of key/value pairs- Returns:
- a Map containing the specified key/value pairs
-
asList
Returns a modifiableListwith the specified element.- Type Parameters:
T- the type of the element- Parameters:
e- the element to be placed in the List- Returns:
- a List containing the specified element
-
asList
Returns a modifiableListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the List- Returns:
- a List containing the specified elements
-
asList
Returns a modifiableListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the List- Returns:
- a List containing the specified elements
-
asList
Returns a modifiableListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the List- Returns:
- a List containing the specified elements
-
asList
Returns a modifiableListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the Liste5- the fifth element to be placed in the List- Returns:
- a List containing the specified elements
-
asList
Returns a modifiableListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the Liste5- the fifth element to be placed in the Liste6- the sixth element to be placed in the List- Returns:
- a List containing the specified elements
-
asList
Returns a modifiableListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the Liste5- the fifth element to be placed in the Liste6- the sixth element to be placed in the Liste7- the seventh element to be placed in the List- Returns:
- a List containing the specified elements
-
asList
Returns a modifiableListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the Liste5- the fifth element to be placed in the Liste6- the sixth element to be placed in the Liste7- the seventh element to be placed in the Liste8- the eighth element to be placed in the List- Returns:
- a List containing the specified elements
-
asList
Returns a modifiableListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the Liste5- the fifth element to be placed in the Liste6- the sixth element to be placed in the Liste7- the seventh element to be placed in the Liste8- the eighth element to be placed in the Liste9- the ninth element to be placed in the List- Returns:
- a List containing the specified elements
-
asList
Returns a modifiableListwith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyListis returned.- Type Parameters:
T- the type of elements in the list- Parameters:
a- the array of elements to be placed in the List- Returns:
- a List containing the specified elements
- See Also:
-
asLinkedList
Returns a modifiableLinkedListwith the specified element.- Type Parameters:
T- the type of the element- Parameters:
e- the element to be placed in the List- Returns:
- a List containing the specified element
-
asLinkedList
Returns a modifiableLinkedListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the List- Returns:
- a List containing the specified elements
-
asLinkedList
Returns a modifiableLinkedListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the List- Returns:
- a List containing the specified elements
-
asLinkedList
Returns a modifiableLinkedListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the List- Returns:
- a List containing the specified elements
-
asLinkedList
Returns a modifiableLinkedListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the Liste5- the fifth element to be placed in the List- Returns:
- a List containing the specified elements
-
asLinkedList
Returns a modifiableLinkedListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the Liste5- the fifth element to be placed in the Liste6- the sixth element to be placed in the List- Returns:
- a List containing the specified elements
-
asLinkedList
Returns a modifiableLinkedListwith specified elements.- Type Parameters:
T- the type of elements in the list- Parameters:
e1- the first element to be placed in the Liste2- the second element to be placed in the Liste3- the third element to be placed in the Liste4- the fourth element to be placed in the Liste5- the fifth element to be placed in the Liste6- the sixth element to be placed in the Liste7- the seventh element to be placed in the List- Returns:
- a List containing the specified elements
-
asLinkedList
Returns a modifiableLinkedListwith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyListis returned.- Type Parameters:
T- the type of elements in the list- Parameters:
a- the array of elements to be placed in the List- Returns:
- a List containing the specified elements
- See Also:
-
asSet
Returns a modifiableSetwith the specified element.- Type Parameters:
T- the type of elements in the set- Parameters:
e- the element to be placed in the Set- Returns:
- a Set containing the specified element
-
asSet
Returns a modifiableSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asSet
Returns a modifiableSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asSet
Returns a modifiableSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asSet
Returns a modifiableSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Sete5- the fifth element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asSet
Returns a modifiableSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Sete5- the fifth element to be placed in the Sete6- the sixth element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asSet
Returns a modifiableSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Sete5- the fifth element to be placed in the Sete6- the sixth element to be placed in the Sete7- the seventh element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asSet
Returns a modifiableSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Sete5- the fifth element to be placed in the Sete6- the sixth element to be placed in the Sete7- the seventh element to be placed in the Sete8- the eighth element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asSet
Returns a modifiableSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Sete5- the fifth element to be placed in the Sete6- the sixth element to be placed in the Sete7- the seventh element to be placed in the Sete8- the eighth element to be placed in the Sete9- the ninth element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asSet
Returns a modifiableSetwith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptySetis returned.- Type Parameters:
T- the type of elements in the set- Parameters:
a- the array of elements to be placed in the set- Returns:
- a Set containing the specified elements
-
asLinkedHashSet
Returns a modifiableLinkedHashSetwith specified element.- Type Parameters:
T- the type of elements in the set- Parameters:
e- the element to be placed in the Set- Returns:
- a Set containing the specified element
-
asLinkedHashSet
Returns a modifiableLinkedHashSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asLinkedHashSet
Returns a modifiableLinkedHashSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asLinkedHashSet
Returns a modifiableLinkedHashSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asLinkedHashSet
Returns a modifiableLinkedHashSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Sete5- the fifth element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asLinkedHashSet
Returns a modifiableLinkedHashSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Sete5- the fifth element to be placed in the Sete6- the sixth element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asLinkedHashSet
Returns a modifiableLinkedHashSetwith the specified elements.- Type Parameters:
T- the type of elements in the set- Parameters:
e1- the first element to be placed in the Sete2- the second element to be placed in the Sete3- the third element to be placed in the Sete4- the fourth element to be placed in the Sete5- the fifth element to be placed in the Sete6- the sixth element to be placed in the Sete7- the seventh element to be placed in the Set- Returns:
- a Set containing the specified elements
-
asLinkedHashSet
Returns a modifiableLinkedHashSetwith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyLinkedHashSetis returned.- Type Parameters:
T- the type of elements in the set- Parameters:
a- the array of elements to be placed in the set- Returns:
- a Set containing the specified elements
-
asSortedSet
Returns a modifiableSortedSetwith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptySortedSetis returned.- Type Parameters:
T- the type of elements in the set- Parameters:
a- the array of elements to be placed in the set- Returns:
- a Set containing the specified elements
-
asQueue
Returns a modifiableQueuewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyQueueis returned.- Type Parameters:
T- the type of elements in the queue- Parameters:
a- the array of elements to be placed in the queue- Returns:
- a queue containing the specified elements
-
asArrayBlockingQueue
Returns a modifiableArrayBlockingQueuewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyArrayBlockingQueueis returned.- Type Parameters:
T- the type of elements in the queue- Parameters:
a- the array of elements to be placed in the queue- Returns:
- a queue containing the specified elements
-
asLinkedBlockingQueue
Returns a modifiableLinkedBlockingQueuewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyLinkedBlockingQueueis returned.- Type Parameters:
T- the type of elements in the queue- Parameters:
a- the array of elements to be placed in the queue- Returns:
- a queue containing the specified elements
-
asConcurrentLinkedQueue
Returns a modifiableConcurrentLinkedQueuewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyConcurrentLinkedQueueis returned.- Type Parameters:
T- the type of elements in the queue- Parameters:
a- the array of elements to be placed in the queue- Returns:
- a queue containing the specified elements
-
asDelayQueue
Returns a modifiableDelayQueuewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyDelayQueueis returned.- Type Parameters:
T- the type of elements in the queue- Parameters:
a- the array of elements to be placed in the queue- Returns:
- a queue containing the specified elements
-
asPriorityQueue
Returns a modifiablePriorityQueuewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyPriorityQueueis returned.- Type Parameters:
T- the type of elements in the queue- Parameters:
a- the array of elements to be placed in the queue- Returns:
- a queue containing the specified elements
-
asDeque
Returns a modifiableDequewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyDequeis returned.- Type Parameters:
T- the type of elements in the deque- Parameters:
a- the array of elements to be placed in the deque- Returns:
- a deque containing the specified elements
-
asArrayDeque
Returns a modifiableArrayDequewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyArrayDequeis returned.- Type Parameters:
T- the type of elements in the deque- Parameters:
a- the array of elements to be placed in the deque- Returns:
- a deque containing the specified elements
-
asLinkedBlockingDeque
Returns a modifiableasLinkedBlockingDequewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyasLinkedBlockingDequeis returned.- Type Parameters:
T- the type of elements in the deque- Parameters:
a- the array of elements to be placed in the deque- Returns:
- a deque containing the specified elements
-
asConcurrentLinkedDeque
Returns a modifiableConcurrentLinkedDequewith specified elements. And it's not backed by the specified array. If the specified array isnullor empty, an emptyConcurrentLinkedDequeis returned.- Type Parameters:
T- the type of elements in the deque- Parameters:
a- the array of elements to be placed in the deque- Returns:
- a deque containing the specified elements
-
asMultiset
Returns a modifiableMultisetwith the specified elements. If the specified array isnullor empty, an empty modifiableMultisetis returned.- Type Parameters:
T- the type of elements in the multiset- Parameters:
a- the array of elements to be placed in the multiset- Returns:
- a Multiset containing the specified elements
-
asSingletonList
Returns an immutable list containing only the specified element.- Type Parameters:
T- the type of the element- Parameters:
e- the element to be wrapped in a singleton list- Returns:
- an immutable/unmodifiable list containing the specified element
- See Also:
-
asSingletonSet
Returns an immutable set containing only the specified element.- Type Parameters:
T- the type of the element- Parameters:
e- the element to be wrapped in a singleton set- Returns:
- an immutable/unmodifiable list containing the specified element
- See Also:
-
asSingletonMap
Returns an immutable map containing only the specified key-value pair.- Type Parameters:
K- the type of keys maintained by the mapV- the type of mapped values- Parameters:
key- the key to be placed in the mapvalue- the value to be associated with the key- Returns:
- an immutable/unmodifiable map containing the specified key-value pair
- See Also:
-
emptyList
Returns an immutable/unmodifiable emptyList.- Type Parameters:
T- the type of elements in the list- Returns:
- an immutable/unmodifiable empty list
- See Also:
-
emptySet
Returns an immutable/unmodifiable emptySet.- Type Parameters:
T- the type of elements in the set- Returns:
- an immutable/unmodifiable empty set
- See Also:
-
emptySortedSet
Returns an immutable/unmodifiable emptySortedSet.- Type Parameters:
T- the type of elements in the set- Returns:
- an immutable/unmodifiable empty set
- See Also:
-
emptyMap
Returns an immutable/unmodifiable emptyMap.- Type Parameters:
K- the key typeV- the value type- Returns:
- an immutable/unmodifiable empty map
- See Also:
-
emptySortedMap
Returns an immutable/unmodifiable emptySortedMap.- Type Parameters:
K- the key typeV- the value type- Returns:
- an immutable/unmodifiable empty sorted map
- See Also:
-
emptyIterator
Returns an immutable/unmodifiable empty iterator.- Type Parameters:
T- the type of elements returned by this iterator- Returns:
- an immutable/unmodifiable empty iterator
- See Also:
-
emptyListIterator
Returns an immutable/unmodifiable emptyListIterator.- Type Parameters:
T- the type of elements returned by this list iterator- Returns:
- an immutable/unmodifiable empty list iterator
- See Also:
-
emptyInputStream
Returns an immutable/unmodifiable emptyInputStream.- Returns:
- an immutable/unmodifiable empty input stream
- See Also:
-
emptyDataSet
Returns an immutable/unmodifiable emptyDataSet.- Returns:
- an immutable/unmodifiable empty DataSet
- See Also:
-
getElement
public static <T> T getElement(@NotNull Iterable<? extends T> c, int index) throws IllegalArgumentException, IndexOutOfBoundsException Retrieves the element at the specified position in the given Iterable.- Type Parameters:
T- the type of elements in the iterable- Parameters:
c- the iterable from which to retrieve the elementindex- the position of the element to retrieve- Returns:
- the element at the specified position in the iterable
- Throws:
IllegalArgumentException- if the iterable is nullIndexOutOfBoundsException- if the index is out of range
-
getElement
public static <T> T getElement(@NotNull Iterator<? extends T> iter, long index) throws IllegalArgumentException, IndexOutOfBoundsException Retrieves the element at the specified position in the given Iterator.- Type Parameters:
T- the type of elements in the Iterator- Parameters:
iter- the Iterator to retrieve the element from. Must not benull.index- the index of the element to retrieve. Must be a non-negative integer.- Returns:
- the element at the specified index in the Iterator
- Throws:
IllegalArgumentException- if the Iterator is nullIndexOutOfBoundsException- if the index is out of range (index invalid input: '<' 0 || index >= size of Iterator)
-
getOnlyElement
public static <T> u.Nullable<T> getOnlyElement(Iterable<? extends T> c) throws TooManyElementsException Returns the only element in the given Iterable.- Type Parameters:
T- the type of elements in the Iterable- Parameters:
c- the Iterable to get the element from- Returns:
- a
Nullablecontaining the only element in the Iterable if it exists, otherwise an empty Nullable - Throws:
TooManyElementsException- if the Iterable contains more than one element
-
getOnlyElement
public static <T> u.Nullable<T> getOnlyElement(Iterator<? extends T> iter) throws TooManyElementsException Returns the only element in the given Iterator.- Type Parameters:
T- the type of elements in the Iterator- Parameters:
iter- the Iterator to get the element from- Returns:
- a
Nullablecontaining the only element in the Iterator if it exists, otherwise an empty Nullable - Throws:
TooManyElementsException- if the Iterator contains more than one element
-
firstElement
Returns the first element in the given Iterable wrapped in aNullable. If the Iterable is empty, an emptyNullableis returned.- Type Parameters:
T- the type of elements in the Iterable- Parameters:
c- the Iterable to get the first element from- Returns:
- a
Nullablecontaining the first element in the Iterable if it exists, otherwise an empty Nullable
-
firstElement
Returns the first element in the given Iterator wrapped in aNullable. If the Iterator is empty, an emptyNullableis returned.- Type Parameters:
T- the type of elements in the Iterator- Parameters:
iter- the Iterator to get the first element from- Returns:
- a
Nullablecontaining the first element in the Iterator if it exists, otherwise an empty Nullable
-
lastElement
Returns the last element in the given Iterable wrapped in aNullable. If the Iterable is empty, an emptyNullableis returned.- Type Parameters:
T- the type of elements in the Iterable- Parameters:
c- the Iterable to get the last element from- Returns:
- a
Nullablecontaining the last element in the Iterable if it exists, otherwise an empty Nullable
-
lastElement
Returns the last element in the given Iterator wrapped in aNullable. If the Iterator is empty, an emptyNullableis returned.- Type Parameters:
T- the type of elements in the Iterator- Parameters:
iter- the Iterator to get the last element from- Returns:
- a
Nullablecontaining the last element in the Iterator if it exists, otherwise an empty Nullable
-
firstElements
@Beta public static <T> List<T> firstElements(Iterable<? extends T> c, int n) throws IllegalArgumentException Returns a list containing the first n elements from the given Iterable. If the Iterable has less than n elements, it returns a list with all the elements in the Iterable.- Type Parameters:
T- the type of elements in the Iterable- Parameters:
c- the Iterable to get the elements fromn- the number of elements to retrieve from the Iterable- Returns:
- a list containing the first n elements from the Iterable
- Throws:
IllegalArgumentException- if n is negative
-
firstElements
@Beta public static <T> List<T> firstElements(Iterator<? extends T> iter, int n) throws IllegalArgumentException Returns a list containing the first n elements from the given Iterator. If the Iterator has less than n elements, it returns a list with all the elements in the Iterator.- Type Parameters:
T- the type of elements in the Iterator- Parameters:
iter- the Iterator to get the elements fromn- the number of elements to retrieve from the Iterator- Returns:
- a list containing the first n elements from the Iterator
- Throws:
IllegalArgumentException- if n is negative
-
lastElements
@Beta public static <T> List<T> lastElements(Iterable<? extends T> c, int n) throws IllegalArgumentException Returns a list containing the last n elements from the given Iterable. If the Iterable has less than n elements, it returns a list with all the elements in the Iterable.- Type Parameters:
T- the type of elements in the Iterable- Parameters:
c- the Iterable to get the elements fromn- the number of elements to retrieve from the end of the Iterable- Returns:
- a list containing the last n elements from the Iterable
- Throws:
IllegalArgumentException- if n is negative
-
lastElements
@Beta public static <T> List<T> lastElements(Iterator<? extends T> iter, int n) throws IllegalArgumentException Returns a list containing the last n elements from the given Iterator. If the Iterator has less than n elements, it returns a list with all the elements in the Iterator.- Type Parameters:
T- the type of elements in the Iterator- Parameters:
iter- the Iterator to get the elements fromn- the number of elements to retrieve from the Iterator- Returns:
- a list containing the last n elements from the Iterator
- Throws:
IllegalArgumentException- if n is negative
-
firstNonNull
Returns the firstnon-nullvalue among the two provided values. If both values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
a- the first value to checkb- the second value to check- Returns:
- an Optional containing the first
non-nullvalue if it exists, otherwise an empty Optional
-
firstNonNull
Returns the firstnon-nullvalue among the three provided values. If all values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
a- the first value to checkb- the second value to checkc- the third value to check- Returns:
- an Optional containing the first
non-nullvalue if it exists, otherwise an empty Optional
-
firstNonNull
Returns the firstnon-nullvalue among the provided values. If all values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
a- the array of values to check- Returns:
- an Optional containing the first
non-nullvalue if it exists, otherwise an empty Optional
-
firstNonNull
Returns the firstnon-nullvalue from the provided iterable. If all values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
c- the iterable of values to check- Returns:
- an Optional containing the first
non-nullvalue if it exists, otherwise an empty Optional
-
firstNonNull
Returns the firstnon-nullvalue from the provided iterator. If all values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
iter- the iterator of values to check- Returns:
- an Optional containing the first
non-nullvalue if it exists, otherwise an empty Optional
-
lastNonNull
Returns the lastnon-nullvalue from the provided values. If both values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
a- the first value to checkb- the second value to check- Returns:
- an Optional containing the last
non-nullvalue if it exists, otherwise an empty Optional
-
lastNonNull
Returns the lastnon-nullvalue from the provided values. If all values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
a- the first value to checkb- the second value to checkc- the third value to check- Returns:
- an Optional containing the last
non-nullvalue if it exists, otherwise an empty Optional
-
lastNonNull
Returns the lastnon-nullvalue from the provided array of values. If all values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
a- the array of values to check- Returns:
- an Optional containing the last
non-nullvalue if it exists, otherwise an empty Optional
-
lastNonNull
Returns the lastnon-nullvalue from the provided iterable. If all values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
c- the iterable to check- Returns:
- an Optional containing the last
non-nullvalue if it exists, otherwise an empty Optional
-
lastNonNull
Returns the lastnon-nullvalue from the provided iterator. If all values arenull, it returns an empty Optional.- Type Parameters:
T- the type of the values- Parameters:
iter- the iterator to check- Returns:
- an Optional containing the last
non-nullvalue if it exists, otherwise an empty Optional
-
firstNonEmpty
Returns the first non-empty array from the given arrays. If both arrays are empty ornull, it returns an empty Optional.- Type Parameters:
T- the type of elements in the arrays- Parameters:
a- the first array to checkb- the second array to check- Returns:
- an Optional containing the first non-empty array, or an empty Optional if both arrays are empty or null
-
firstNonEmpty
Returns the first non-empty array from the given arrays. If all arrays are empty ornull, it returns an empty Optional.- Type Parameters:
T- the type of elements in the arrays- Parameters:
a- the first array to checkb- the second array to checkc- the third array to check- Returns:
- an Optional containing the first non-empty array, or an empty Optional if all arrays are empty or null
-
firstNonEmpty
Returns the first non-empty collection from the given collections. If both collections are empty ornull, it returns an empty Optional.- Type Parameters:
T- the type of the collections- Parameters:
a- the first collection to checkb- the second collection to check- Returns:
- an Optional containing the first non-empty collection, or an empty Optional if both collections are empty or null
-
firstNonEmpty
Returns the first non-empty collection from the given collections. If all collections are empty ornull, it returns an empty Optional.- Type Parameters:
T- the type of the collections- Parameters:
a- the first collection to checkb- the second collection to checkc- the third collection to check- Returns:
- an Optional containing the first non-empty collection, or an empty Optional if all collections are empty or null
-
firstNonEmpty
Returns the first non-empty CharSequence from the given CharSequences. If both CharSequences are empty ornull, it returns an empty Optional.- Type Parameters:
T- the type of the CharSequences- Parameters:
a- the first CharSequence to checkb- the second CharSequence to check- Returns:
- an Optional containing the first non-empty CharSequence, or an empty Optional if both CharSequences are empty or null
-
firstNonEmpty
Returns the first non-empty CharSequence from the given CharSequences. If all CharSequences are empty ornull, it returns an empty Optional.- Type Parameters:
T- the type of the CharSequences- Parameters:
a- the first CharSequence to checkb- the second CharSequence to checkc- the third CharSequence to check- Returns:
- an Optional containing the first non-empty CharSequence, or an empty Optional if all CharSequences are empty or null
-
firstNonEmpty
Returns the first non-empty CharSequence from the given CharSequences. If all CharSequences are empty ornull, it returns an empty Optional.- Type Parameters:
T- the type of the CharSequences- Parameters:
a- the array of CharSequences to check- Returns:
- an Optional containing the first non-empty CharSequence, or an empty Optional if all CharSequences are empty or null
-
firstNonBlank
Returns the first non-blank CharSequence from the given CharSequences. If both CharSequences are blank ornull, it returns an empty Optional.- Type Parameters:
T- the type of the CharSequences- Parameters:
a- the first CharSequence to checkb- the second CharSequence to check- Returns:
- an Optional containing the first non-blank CharSequence, or an empty Optional if both CharSequences are blank or null
-
firstNonBlank
Returns the first non-blank CharSequence from the given CharSequences. If all CharSequences are blank ornull, it returns an empty Optional.- Type Parameters:
T- the type of the CharSequences- Parameters:
a- the first CharSequence to checkb- the second CharSequence to checkc- the third CharSequence to check- Returns:
- an Optional containing the first non-blank CharSequence, or an empty Optional if all CharSequences are blank or null
-
firstNonBlank
Returns the first non-blank CharSequence from the given CharSequences. If all CharSequences are blank ornull, it returns an empty Optional.- Type Parameters:
T- the type of the CharSequences- Parameters:
a- the array of CharSequences to check- Returns:
- an Optional containing the first non-blank CharSequence, or an empty Optional if all CharSequences are blank or null
-
firstEntry
Returns the first entry from the given map. If the map isnullor empty, it returns an empty Optional.- Type Parameters:
K- the type of keys maintained by the mapV- the type of mapped values- Parameters:
map- the map from which to retrieve the first entry- Returns:
- an Optional containing the first entry of the map, or an empty Optional if the map is
nullor empty
-
lastEntry
Returns the last entry from the given map. If the map isnullor empty, it returns an empty Optional.- Type Parameters:
K- the type of keys maintained by the mapV- the type of mapped values- Parameters:
map- the map from which to retrieve the last entry- Returns:
- an Optional containing the last entry of the map, or an empty Optional if the map is
nullor empty
-
firstOrNullIfEmpty
public static <T> T firstOrNullIfEmpty(T[] a) Returns the first element of the given array if it is not empty, otherwise returnsnull.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to check- Returns:
- the first element of the array if it is not empty, otherwise null
-
firstOrNullIfEmpty
Returns the first element of the given iterable if it is not empty, otherwise returnsnull.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable to check- Returns:
- the first element of the iterable if it is not empty, otherwise null
-
firstOrNullIfEmpty
Returns the first element of the given iterator if it is not empty, otherwise returnsnull.- Type Parameters:
T- the type of the elements in the iterator- Parameters:
iter- the iterator to check- Returns:
- the first element of the iterator if it is not empty, otherwise null
-
firstOrDefaultIfEmpty
public static <T> T firstOrDefaultIfEmpty(T[] a, T defaultValueForEmpty) Returns the first element of the given array if it is not empty, otherwise returns the specified default value.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to checkdefaultValueForEmpty- the default value to return if the array is empty- Returns:
- the first element of the array if it is not empty, otherwise the specified default value
-
firstOrDefaultIfEmpty
Returns the first element of the given iterable if it is not empty, otherwise returns the specified default value.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable to checkdefaultValueForEmpty- the default value to return if the iterable is empty- Returns:
- the first element of the iterable if it is not empty, otherwise the specified default value
-
firstOrDefaultIfEmpty
Returns the first element of the given iterator if it is not empty, otherwise returns the specified default value.- Type Parameters:
T- the type of the elements in the iterator- Parameters:
iter- the iterator to checkdefaultValueForEmpty- the default value to return if the iterator is empty- Returns:
- the first element of the iterator if it is not empty, otherwise the specified default value
-
lastOrNullIfEmpty
public static <T> T lastOrNullIfEmpty(T[] a) Returns the last element of the given array if it is not empty, otherwise returnsnull.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to check- Returns:
- the last element of the array if it is not empty, otherwise null
-
lastOrNullIfEmpty
Returns the last element of the given iterable if it is not empty, otherwise returnsnull.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable to check- Returns:
- the last element of the iterable if it is not empty, otherwise null
-
lastOrNullIfEmpty
Returns the last element of the given iterator if it is not empty, otherwise returnsnull.- Type Parameters:
T- the type of the elements in the iterator- Parameters:
iter- the iterator to check- Returns:
- the last element of the iterator if it is not empty, otherwise null
-
lastOrDefaultIfEmpty
public static <T> T lastOrDefaultIfEmpty(T[] a, T defaultValueForEmpty) Returns the last element of the given array if it is not empty, otherwise returns the specified default value.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to checkdefaultValueForEmpty- the default value to return if the array is empty- Returns:
- the last element of the array if it is not empty, otherwise the specified default value
-
lastOrDefaultIfEmpty
Returns the last element of the given iterable if it is not empty, otherwise returns the specified default value.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable to checkdefaultValueForEmpty- the default value to return if the iterable is empty- Returns:
- the last element of the iterable if it is not empty, otherwise the specified default value
-
lastOrDefaultIfEmpty
Returns the last element of the given iterator if it is not empty, otherwise returns the specified default value.- Type Parameters:
T- the type of the elements in the iterator- Parameters:
iter- the iterator to checkdefaultValueForEmpty- the default value to return if the iterator is empty- Returns:
- the last element of the iterator if it is not empty, otherwise the specified default value
-
findFirst
Returns the first element in the given array that matches the specified predicate.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to searchpredicate- the predicate to apply to elements of the array- Returns:
- an Optional containing the first element that matches the predicate, or an empty Optional if no such element is found
-
findFirst
Returns the first element in the given iterable that matches the specified predicate.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable to searchpredicate- the predicate to apply to elements of the iterable- Returns:
- an Optional containing the first element that matches the predicate, or an empty Optional if no such element is found
-
findFirst
public static <T> u.Nullable<T> findFirst(Iterator<? extends T> iter, Predicate<? super T> predicate) Returns the first element in the given iterator that matches the specified predicate.- Type Parameters:
T- the type of the elements in the iterator- Parameters:
iter- the iterator to searchpredicate- the predicate to apply to elements of the iterator- Returns:
- an Optional containing the first element that matches the predicate, or an empty Optional if no such element is found
-
findLast
Returns the last element in the given array that matches the specified predicate.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to searchpredicate- the predicate to apply to elements of the array- Returns:
- an Optional containing the last element that matches the predicate, or an empty Optional if no such element is found
-
findLast
Returns the last element in the given iterable that matches the specified predicate.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable to searchpredicate- the predicate to apply to elements of the iterable- Returns:
- an Optional containing the last element that matches the predicate, or an empty Optional if no such element is found
-
findFirstNonNull
Returns the firstnon-nullelement in the given array that matches the specified predicate.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to searchpredicate- the predicate to apply to elements of the array- Returns:
- an Optional containing the first
non-nullelement that matches the predicate, or an empty Optional if no such element is found
-
findFirstNonNull
public static <T> u.Optional<T> findFirstNonNull(Iterable<? extends T> c, Predicate<? super T> predicate) Returns the firstnon-nullelement in the given iterable that matches the specified predicate.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable to searchpredicate- the predicate to apply to elements of the iterable- Returns:
- an Optional containing the first
non-nullelement that matches the predicate, or an empty Optional if no such element is found
-
findFirstNonNull
public static <T> u.Optional<T> findFirstNonNull(Iterator<? extends T> iter, Predicate<? super T> predicate) Returns the firstnon-nullelement in the given iterator that matches the specified predicate.- Type Parameters:
T- the type of the elements in the iterator- Parameters:
iter- the iterator to searchpredicate- the predicate to apply to elements of the iterator- Returns:
- an Optional containing the first
non-nullelement that matches the predicate, or an empty Optional if no such element is found
-
findLastNonNull
Returns the lastnon-nullelement in the given array that matches the specified predicate.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to searchpredicate- the predicate to apply to elements of the array- Returns:
- an Optional containing the last
non-nullelement that matches the predicate, or an empty Optional if no such element is found
-
findLastNonNull
public static <T> u.Optional<T> findLastNonNull(Iterable<? extends T> c, Predicate<? super T> predicate) Returns the lastnon-nullelement in the given iterable that matches the specified predicate.- Type Parameters:
T- the type of the elements in the iterable- Parameters:
c- the iterable to searchpredicate- the predicate to apply to elements of the iterable- Returns:
- an Optional containing the last
non-nullelement that matches the predicate, or an empty Optional if no such element is found
-
len
Returns the length of the specifiedCharSequence, or0if it's empty ornull.- Parameters:
s- the CharSequence to check- Returns:
- the length of the CharSequence, or 0 if the CharSequence is null
-
len
public static int len(boolean[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
len
public static int len(char[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
len
public static int len(byte[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
len
public static int len(short[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
len
public static int len(int[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
len
public static int len(long[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
len
public static int len(float[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
len
public static int len(double[] a) Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
len
Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the array to check- Returns:
- the length of the array, or 0 if the array is null
-
size
Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the collection to check- Returns:
- the size of the specified collection, or 0 if the collection is null
-
size
Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the map to check- Returns:
- the size of the specified map, or 0 if the map is null
-
size
Returns the length/size of the specifiedArray/Collection/Map, or0if it's empty ornull.- Parameters:
a- the PrimitiveList to check- Returns:
- the size of the specified PrimitiveList, or 0 if the PrimitiveList is null
-
nullToEmpty
Converts anullstring to an empty string.- Parameters:
str- the string to check- Returns:
- the original string if it is not
null, otherwise an empty string - See Also:
-
nullToEmpty
Returns an immutable/unmodifiable empty list if the specified list isnull, otherwise itself is returned.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to check- Returns:
- an empty list if the specified list is
null, otherwise the original list - See Also:
-
nullToEmpty
Returns an immutable/unmodifiable empty set if the specified Set isnull, otherwise itself is returned.- Type Parameters:
T- the type of elements in the set- Parameters:
set- the set to check- Returns:
- an empty set if the specified set is
null, otherwise the original set - See Also:
-
nullToEmpty
Returns an immutable/unmodifiable emptySortedSetif the specified SortedSet isnull, otherwise itself is returned.- Type Parameters:
T- the type of elements in the set- Parameters:
set- the set to check- Returns:
- an empty
SortedSetif the specified set isnull, otherwise the original set - See Also:
-
nullToEmpty
Returns an immutable/unmodifiable emptyListif the specified list isnull, otherwise itself is returned.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to check- Returns:
- an empty
Listif the specified list isnull, otherwise the original list - See Also:
-
nullToEmpty
Returns an immutable/unmodifiable empty map if the specified Map isnull, otherwise itself is returned.- Type Parameters:
K- the key typeV- the value type- Parameters:
map- the map to check- Returns:
- an empty map if the specified map is
null, otherwise the original map - See Also:
-
nullToEmpty
Returns an immutable/unmodifiable emptySortedMapif the specified SortedMap isnull, otherwise itself is returned.- Type Parameters:
K- the key typeV- the value type- Parameters:
map- the SortedMap to check- Returns:
- an empty
SortedMapif the specified SortedMap isnull, otherwise the original SortedMap - See Also:
-
nullToEmpty
Returns an immutable/unmodifiable empty iterator if the specified Iterator isnull, otherwise itself is returned.- Type Parameters:
T- the type of elements returned by this iterator- Parameters:
iter- the iterator to check- Returns:
- an empty iterator if the specified Iterator is
null, otherwise the original Iterator - See Also:
-
nullToEmpty
Returns an immutable/unmodifiable emptyListIteratorif the specified ListIterator isnull, otherwise itself is returned.- Type Parameters:
T- the type of elements returned by this list iterator- Parameters:
iter- the list iterator to check- Returns:
- an empty
ListIteratorif the specified ListIterator isnull, otherwise the original ListIterator - See Also:
-
nullToEmpty
public static boolean[] nullToEmpty(boolean[] a) Returns an empty boolean array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the boolean array to check- Returns:
- an empty boolean array if the specified array is
null, otherwise the original array
-
nullToEmpty
public static char[] nullToEmpty(char[] a) Returns an empty char array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the char array to check- Returns:
- an empty char array if the specified array is
null, otherwise the original array
-
nullToEmpty
public static byte[] nullToEmpty(byte[] a) Returns an empty byte array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the byte array to check- Returns:
- an empty byte array if the specified array is
null, otherwise the original array
-
nullToEmpty
public static short[] nullToEmpty(short[] a) Returns an empty short array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the short array to check- Returns:
- an empty short array if the specified array is
null, otherwise the original array
-
nullToEmpty
public static int[] nullToEmpty(int[] a) Returns an empty int array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the int array to check- Returns:
- an empty int array if the specified array is
null, otherwise the original array
-
nullToEmpty
public static long[] nullToEmpty(long[] a) Returns an empty long array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the long array to check- Returns:
- an empty long array if the specified array is
null, otherwise the original array
-
nullToEmpty
public static float[] nullToEmpty(float[] a) Returns an empty float array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the float array to check- Returns:
- an empty float array if the specified array is
null, otherwise the original array
-
nullToEmpty
public static double[] nullToEmpty(double[] a) Returns an empty double array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the double array to check- Returns:
- an empty double array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty BigInteger array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the BigInteger array to check- Returns:
- an empty BigInteger array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty BigDecimal array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the BigDecimal array to check- Returns:
- an empty BigDecimal array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty String array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the String array to check- Returns:
- an empty String array if the specified array is
null, otherwise the original array - See Also:
-
nullToEmptyForEach
Converts the specified String array to an emptyString[0]if it'snulland eachnullelement String to empty String"".- Parameters:
a- the String array to check- Returns:
- an empty String array if the specified array is
null, otherwise the original array with eachnullelement replaced by an empty string - See Also:
-
nullToEmpty
Returns an empty Date array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the Date array to check- Returns:
- an empty Date array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty Date array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the Date array to check- Returns:
- an empty Date array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty Time array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the Time array to check- Returns:
- an empty Time array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty Timestamp array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the Timestamp array to check- Returns:
- an empty Timestamp array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty Calendar array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the Calendar array to check- Returns:
- an empty Calendar array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty Object array if the specified array isnull, otherwise returns the original array.- Parameters:
a- the Object array to check- Returns:
- an empty Object array if the specified array is
null, otherwise the original array
-
nullToEmpty
Returns an empty array of the specified type if the given array isnull, otherwise returns the original array.- Type Parameters:
T- the component type of the array- Parameters:
a- the array to checkarrayType- the class of the array type- Returns:
- an empty array of the specified type if the given array is
null, otherwise the original array
-
nullToEmpty
Returns an immutable/unmodifiable empty Collection if the specified ImmutableCollection isnull, otherwise itself is returned.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the ImmutableCollection to check- Returns:
- an empty ImmutableCollection if the specified collection is
null, otherwise the original collection
-
nullToEmpty
Returns an immutable/unmodifiable empty list if the specified ImmutableList isnull, otherwise returns the original list.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the ImmutableList to check- Returns:
- an empty ImmutableList if the specified list is
null, otherwise the original list
-
nullToEmpty
Returns an immutable/unmodifiable empty set if the specified ImmutableSet isnull, otherwise returns the original set.- Type Parameters:
T- the type of elements in the set- Parameters:
set- the ImmutableSet to check- Returns:
- an empty ImmutableSet if the specified set is
null, otherwise the original set
-
nullToEmpty
Returns an immutable/unmodifiable empty sorted set if the specified ImmutableSortedSet isnull, otherwise returns the original set.- Type Parameters:
T- the type of elements in the set- Parameters:
set- the ImmutableSortedSet to check- Returns:
- an empty ImmutableSortedSet if the specified set is
null, otherwise the original set
-
nullToEmpty
Returns an immutable/unmodifiable empty map if the specified ImmutableMap isnull, otherwise returns the original map.- Type Parameters:
K- the type of keys in the mapV- the type of values in the map- Parameters:
map- the ImmutableMap to check- Returns:
- an empty ImmutableMap if the specified map is
null, otherwise the original map
-
nullToEmpty
Returns an immutable/unmodifiable empty sorted map if the specified ImmutableSortedMap isnull, otherwise returns the original map.- Type Parameters:
K- the type of keys in the mapV- the type of values in the map- Parameters:
map- the ImmutableSortedMap to check- Returns:
- an empty ImmutableSortedMap if the specified map is
null, otherwise the original map
-
nullToEmpty
Returns an immutable/unmodifiable empty bi-map if the specified ImmutableBiMap isnull, otherwise returns the original bi-map.- Type Parameters:
K- the type of keys in the bi-mapV- the type of values in the bi-map- Parameters:
map- the ImmutableBiMap to check- Returns:
- an empty ImmutableBiMap if the specified bi-map is
null, otherwise the original bi-map
-
isEmpty
Checks if the specifiedCharSequenceisnullor empty.- Parameters:
cs- the CharSequence to check- Returns:
trueif the CharSequence isnullor empty, otherwisefalse
-
isEmpty
public static boolean isEmpty(boolean[] a) Checks if the specified boolean array isnullor empty.- Parameters:
a- the boolean array to check- Returns:
trueif the boolean array isnullor empty, otherwise false
-
isEmpty
public static boolean isEmpty(char[] a) Checks if the specified char array isnullor empty.- Parameters:
a- the char array to check- Returns:
trueif the char array isnullor empty, otherwise false
-
isEmpty
public static boolean isEmpty(byte[] a) Checks if the specified byte array isnullor empty.- Parameters:
a- the byte array to check- Returns:
trueif the byte array isnullor empty, otherwise false
-
isEmpty
public static boolean isEmpty(short[] a) Checks if the specified short array isnullor empty.- Parameters:
a- the short array to check- Returns:
trueif the short array isnullor empty, otherwise false
-
isEmpty
public static boolean isEmpty(int[] a) Checks if the specified int array isnullor empty.- Parameters:
a- the int array to check- Returns:
trueif the int array isnullor empty, otherwise false
-
isEmpty
public static boolean isEmpty(long[] a) Checks if the specified long array isnullor empty.- Parameters:
a- the long array to check- Returns:
trueif the long array isnullor empty, otherwise false
-
isEmpty
public static boolean isEmpty(float[] a) Checks if the specified float array isnullor empty.- Parameters:
a- the float array to check- Returns:
trueif the float array isnullor empty, otherwise false
-
isEmpty
public static boolean isEmpty(double[] a) Checks if the specified double array isnullor empty.- Parameters:
a- the double array to check- Returns:
trueif the double array isnullor empty, otherwise false
-
isEmpty
Checks if the specified object array isnullor empty.- Parameters:
a- the object array to check- Returns:
trueif the object array isnullor empty, otherwise false
-
isEmpty
Checks if the specifiedCollectionisnullor empty.- Parameters:
c- the Collection to check- Returns:
trueif the Collection isnullor empty, otherwisefalse
-
isEmpty
Checks if the specified iterable isnullor empty.- Parameters:
c- the Iterable to check- Returns:
trueif the Iterable isnullor empty, otherwisefalse
-
isEmpty
Checks if the specified iterator isnullor empty.- Parameters:
iter- the Iterator to check- Returns:
trueif the Iterator isnullor empty, otherwisefalse
-
isEmpty
Checks if the specifiedMapisnullor empty.- Parameters:
m- the Map to check- Returns:
trueif the Map isnullor empty, otherwisefalse
-
isEmpty
Checks if the specifiedPrimitiveListisnullor empty.- Parameters:
list- the PrimitiveList to check- Returns:
trueif the PrimitiveList isnullor empty, otherwisefalse
-
isEmpty
Checks if the specifiedMultisetisnullor empty.- Parameters:
s- the Multiset to check- Returns:
trueif the Multiset isnullor empty, otherwisefalse
-
isEmpty
Checks if the specifiedMultimapisnullor empty.- Parameters:
m- the Multimap to check- Returns:
trueif the Multimap isnullor empty, otherwisefalse
-
isEmpty
Checks if the specifiedDataSetisnullor empty.- Parameters:
ds- the DataSet to check- Returns:
trueif the DataSet isnullor empty, otherwisefalse
-
isBlank
Checks if the specifiedCharSequenceisnull, empty, or contains only whitespace characters.- Parameters:
cs- the CharSequence to check- Returns:
trueif the CharSequence isnull, empty, or contains only whitespace characters, otherwisefalse- See Also:
-
notEmpty
Checks if the specifiedCharSequenceis notnulland not empty.- Parameters:
cs- the CharSequence to check- Returns:
trueif the CharSequence is notnulland not empty, otherwisefalse- See Also:
-
notEmpty
public static boolean notEmpty(boolean[] a) Checks if the specified boolean array is notnulland not empty.- Parameters:
a- the boolean array to check- Returns:
trueif the boolean array is notnulland not empty, otherwisefalse
-
notEmpty
public static boolean notEmpty(char[] a) Checks if the specified char array is notnulland not empty.- Parameters:
a- the char array to check- Returns:
trueif the char array is notnulland not empty, otherwisefalse
-
notEmpty
public static boolean notEmpty(byte[] a) Checks if the specified byte array is notnulland not empty.- Parameters:
a- the byte array to check- Returns:
trueif the byte array is notnulland not empty, otherwisefalse
-
notEmpty
public static boolean notEmpty(short[] a) Checks if the specified short array is notnulland not empty.- Parameters:
a- the short array to check- Returns:
trueif the short array is notnulland not empty, otherwisefalse
-
notEmpty
public static boolean notEmpty(int[] a) Checks if the specified int array is notnulland not empty.- Parameters:
a- the int array to check- Returns:
trueif the int array is notnulland not empty, otherwisefalse
-
notEmpty
public static boolean notEmpty(long[] a) Checks if the specified long array is notnulland not empty.- Parameters:
a- the long array to check- Returns:
trueif the long array is notnulland not empty, otherwisefalse
-
notEmpty
public static boolean notEmpty(float[] a) Checks if the specified float array is notnulland not empty.- Parameters:
a- the float array to check- Returns:
trueif the float array is notnulland not empty, otherwisefalse
-
notEmpty
public static boolean notEmpty(double[] a) Checks if the specified double array is notnulland not empty.- Parameters:
a- the double array to check- Returns:
trueif the double array is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specified object array is notnulland not empty.- Parameters:
a- the object array to check- Returns:
trueif the object array is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specifiedCollectionis notnulland not empty.- Parameters:
c- the Collection to check- Returns:
trueif the Collection is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specified iterable is notnulland not empty.- Parameters:
iter- the Iterable to check- Returns:
trueif the Iterable is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specified iterator is notnulland not empty.- Parameters:
iter- the Iterator to check- Returns:
trueif the Iterator is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specifiedMapis notnulland not empty.- Parameters:
m- the Map to check- Returns:
trueif the Map is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specifiedPrimitiveListis notnulland not empty.- Parameters:
list- the PrimitiveList to check- Returns:
trueif the PrimitiveList is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specifiedMultisetis notnulland not empty.- Parameters:
s- the Multiset to check- Returns:
trueif the Multiset is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specifiedMultimapis notnulland not empty.- Parameters:
m- the Multimap to check- Returns:
trueif the Multimap is notnulland not empty, otherwisefalse
-
notEmpty
Checks if the specifiedDataSetis notnulland not empty.- Parameters:
ds- the DataSet to check- Returns:
trueif the DataSet is notnulland not empty, otherwisefalse
-
notBlank
Checks if the specifiedCharSequenceis notnulland not empty and not contains only whitespace characters.- Parameters:
cs- the CharSequence to check- Returns:
trueif the CharSequence is notnulland not empty and not contains only whitespace characters, otherwisefalse- See Also:
-
anyNull
Checks if any of the specified objects isnull.- Parameters:
a- the first object to checkb- the second object to check- Returns:
trueif any of the objects isnull, otherwisefalse
-
anyNull
Checks if any of the specified objects isnull.- Parameters:
a- the first object to checkb- the second object to checkc- the third object to check- Returns:
trueif any of the objects isnull, otherwisefalse
-
anyNull
Checks if any element in the specified array isnull.- Parameters:
a- the array of objects to check- Returns:
trueif any element in the specified array isnull, otherwisefalse
-
anyNull
Checks if any element in the specified collection isnull.- Parameters:
c- the collection of objects to check- Returns:
trueif any element in the specified collection isnull, otherwisefalse
-
anyEmpty
Checks if any of the specified CharSequences is empty ("") ornull.- Parameters:
a- the first CharSequence to checkb- the second CharSequence to check- Returns:
trueif any of the CharSequences is empty, otherwisefalse- See Also:
-
anyEmpty
Checks if any of the specified CharSequences is empty ("") ornull.- Parameters:
a- the first CharSequence to checkb- the second CharSequence to checkc- the third CharSequence to check- Returns:
trueif any of the CharSequences is empty, otherwisefalse- See Also:
-
anyEmpty
Checks if any of the CharSequences is empty ("") or
null.Strings.anyEmpty((String) null) = true Strings.anyEmpty((String[]) null) = false Strings.anyEmpty(null, "foo") = true Strings.anyEmpty("", "bar") = true Strings.anyEmpty("bob", "") = true Strings.anyEmpty(" bob ", null) = true Strings.anyEmpty(" ", "bar") = false Strings.anyEmpty("foo", "bar") = false Strings.anyEmpty(new String[]{}) = false Strings.anyEmpty(new String[]{""}) = true- Parameters:
css- the CharSequences to check, may benullor empty- Returns:
trueif any of the CharSequences are empty or null- See Also:
-
anyEmpty
Checks if any of the specified CharSequence objects in the collection is empty.- Parameters:
css- the collection of CharSequence objects to check- Returns:
trueif any of the CharSequence objects is empty, otherwisefalse- See Also:
-
anyEmpty
Checks if any of the specified arrays is empty.- Parameters:
a- the first array to checkb- the second array to check- Returns:
trueif any of the arrays is empty, otherwisefalse
-
anyEmpty
Checks if any of the specified arrays is empty.- Parameters:
a- the first array to checkb- the second array to checkc- the third array to check- Returns:
trueif any of the arrays is empty, otherwisefalse
-
anyEmpty
Checks if any of the specified collections is empty.- Parameters:
a- the first collection to checkb- the second collection to check- Returns:
trueif any of the collections is empty, otherwisefalse
-
anyEmpty
Checks if any of the specified collections is empty.- Parameters:
a- the first collection to checkb- the second collection to checkc- the third collection to check- Returns:
trueif any of the collections is empty, otherwisefalse
-
anyBlank
Checks if any of the specified CharSequences is blank.- Parameters:
a- the first CharSequence to checkb- the second CharSequence to check- Returns:
trueif any of the CharSequences is blank, otherwisefalse- See Also:
-
anyBlank
Checks if any of the specified CharSequences is blank.- Parameters:
a- the first CharSequence to checkb- the second CharSequence to checkc- the third CharSequence to check- Returns:
trueif any of the CharSequences is blank, otherwisefalse- See Also:
-
anyBlank
Checks if any of the CharSequences are empty ("") or
nullor whitespace only.Whitespace is defined by
Character.isWhitespace(char).Strings.anyBlank((String) null) = true Strings.anyBlank((String[]) null) = false Strings.anyBlank(null, "foo") = true Strings.anyBlank(null, null) = true Strings.anyBlank("", "bar") = true Strings.anyBlank("bob", "") = true Strings.anyBlank(" bob ", null) = true Strings.anyBlank(" ", "bar") = true Strings.anyBlank(new String[] {}) = false Strings.anyBlank(new String[]{""}) = true Strings.anyBlank("foo", "bar") = false- Parameters:
css- the CharSequences to check, may benullor empty- Returns:
trueif any of the CharSequences are empty ornullor whitespace only- See Also:
-
anyBlank
Checks if any of the specified CharSequences in the collection is blank.- Parameters:
css- the collection of CharSequences to check- Returns:
trueif any of the CharSequences is blank, otherwisefalse- See Also:
-
allNull
Checks if both specified objects arenull.- Parameters:
a- the first object to checkb- the second object to check- Returns:
trueif both objects arenull, otherwisefalse
-
allNull
Checks if all specified objects arenull.- Parameters:
a- the first object to checkb- the second object to checkc- the third object to check- Returns:
trueif all objects arenull, otherwisefalse
-
allNull
Checks if all specified objects arenull.- Parameters:
a- the objects to check- Returns:
trueif all objects arenull, otherwisefalse
-
allNull
Checks if all elements in the specified collection arenull.- Parameters:
c- the collection of objects to check- Returns:
trueif all elements in the specified collection arenull, otherwisefalse
-
allEmpty
Checks if both specified CharSequences are empty ("") ornull.- Parameters:
a- the first CharSequence to checkb- the second CharSequence to check- Returns:
trueif both CharSequences are empty, otherwisefalse- See Also:
-
allEmpty
Checks if all of the specified CharSequences are empty ("") ornull.- Parameters:
a- the first CharSequence to checkb- the second CharSequence to checkc- the third CharSequence to check- Returns:
trueif all of the CharSequences are empty, otherwisefalse- See Also:
-
allEmpty
Checks if all of the CharSequences are empty ("") or
null.Strings.allEmpty(null) = true Strings.allEmpty(null, "") = true Strings.allEmpty(new String[] {}) = true Strings.allEmpty(null, "foo") = false Strings.allEmpty("", "bar") = false Strings.allEmpty("bob", "") = false Strings.allEmpty(" bob ", null) = false Strings.allEmpty(" ", "bar") = false Strings.allEmpty("foo", "bar") = false- Parameters:
css- the CharSequences to check, may benullor empty- Returns:
trueif all of the CharSequences are empty or null- See Also:
-
allEmpty
Checks if all specified CharSequences in the collection are empty ornull.- Parameters:
css- the collection of CharSequences to check, may benullor empty- Returns:
trueif all CharSequences in the collection are empty ornull, otherwisefalse
-
allEmpty
Checks if all specified object arrays are empty.- Parameters:
a- the first object array to check, may be nullb- the second object array to check, may be null- Returns:
trueif both object arrays are empty ornull, otherwisefalse
-
allEmpty
Checks if all specified object arrays are empty.- Parameters:
a- the first object array to check, may be nullb- the second object array to check, may be nullc- the third object array to check, may be null- Returns:
trueif all object arrays are empty ornull, otherwisefalse
-
allEmpty
Checks if all specified collections are empty.- Parameters:
a- the first collection to check, may be nullb- the second collection to check, may be null- Returns:
trueif both collections are empty ornull, otherwisefalse
-
allEmpty
Checks if all specified collections are empty.- Parameters:
a- the first collection to check, may be nullb- the second collection to check, may be nullc- the third collection to check, may be null- Returns:
trueif all collections are empty ornull, otherwisefalse
-
allBlank
Checks if both specified CharSequences are blank.- Parameters:
a- the first CharSequence to checkb- the second CharSequence to check- Returns:
trueif both CharSequences are blank, otherwisefalse- See Also:
-
allBlank
Checks if all of the specified CharSequences are blank.- Parameters:
a- the first CharSequence to checkb- the second CharSequence to checkc- the third CharSequence to check- Returns:
trueif all of the CharSequences are blank, otherwisefalse- See Also:
-
allBlank
Checks if all of the CharSequences are empty (""),
nullor whitespace only.Whitespace is defined by
Character.isWhitespace(char).Strings.allBlank(null) = true Strings.allBlank(null, "foo") = false Strings.allBlank(null, null) = true Strings.allBlank("", "bar") = false Strings.allBlank("bob", "") = false Strings.allBlank(" bob ", null) = false Strings.allBlank(" ", "bar") = false Strings.allBlank("foo", "bar") = false Strings.allBlank(new String[] {}) = true- Parameters:
css- the CharSequences to check, may benullor empty- Returns:
trueif all of the CharSequences are empty ornullor whitespace only- See Also:
-
allBlank
Checks if all specified CharSequences in the collection are blank.- Parameters:
css- the collection of CharSequences to check- Returns:
trueif all CharSequences in the collection are blank, otherwisefalse- See Also:
-
checkFromToIndex
public static void checkFromToIndex(int fromIndex, int toIndex, int length) throws IndexOutOfBoundsException Checks if the specified range starting fromfromIndexand ending withtoIndexare within the bounds of the specified length.- Parameters:
fromIndex- the starting index to check, inclusivetoIndex- the ending index to check, exclusivelength- the length of the array or collection- Throws:
IndexOutOfBoundsException- if the range is out of bounds
-
checkFromIndexSize
public static void checkFromIndexSize(int fromIndex, int size, int length) throws IndexOutOfBoundsException Checks if the specified range starting fromfromIndexwith the specifiedsizeis within the bounds of the specified length.- Parameters:
fromIndex- the starting index to check, inclusivesize- the size of the range to checklength- the length of the array or collection- Throws:
IndexOutOfBoundsException- if the range is out of bounds
-
checkIndex
Deprecated.UsecheckElementIndex(int,int)insteadEnsures thatindexspecifies a valid element in an array, list or string of sizesize. An element index may range from zero, inclusive, tosize, exclusive.- Parameters:
index- a user-supplied index identifying an element of an array, list or stringsize- the size of that array, list or string- Returns:
- the value of
index - Throws:
IndexOutOfBoundsException- ifindexis negative or is not less thansizeIllegalArgumentException- ifsizeis negative
-
checkElementIndex
public static int checkElementIndex(int index, int size) Copied from Google Guava under Apache License v2.0 and may be modified.
Ensures thatindexspecifies a valid element in an array, list or string of sizesize. An element index may range from zero, inclusive, tosize, exclusive.- Parameters:
index- a user-supplied index identifying an element of an array, list or stringsize- the size of that array, list or string- Returns:
- the value of
index - Throws:
IndexOutOfBoundsException- ifindexis negative or is not less thansizeIllegalArgumentException- ifsizeis negative
-
checkElementIndex
Copied from Google Guava under Apache License v2.0 and may be modified.
Ensures thatindexspecifies a valid element in an array, list or string of sizesize. An element index may range from zero, inclusive, tosize, exclusive.- Parameters:
index- a user-supplied index identifying an element of an array, list or stringsize- the size of that array, list or stringdesc- the text to use to describe this index in an error message- Returns:
- the value of
index - Throws:
IndexOutOfBoundsException- ifindexis negative or is not less thansizeIllegalArgumentException- ifsizeis negative
-
checkPositionIndex
public static int checkPositionIndex(int index, int size) throws IllegalArgumentException, IndexOutOfBoundsException Copied from Google Guava under Apache License v2.0 and may be modified.
Ensures thatindexspecifies a valid position in an array, list or string of sizesize. A position index may range from zero tosize, inclusive.- Parameters:
index- a user-supplied index identifying a position in an array, list or stringsize- the size of that array, list or string- Returns:
- the value of
index - Throws:
IllegalArgumentException- ifsizeis negativeIndexOutOfBoundsException- ifindexis negative or is greater thansize
-
checkPositionIndex
public static int checkPositionIndex(int index, int size, String desc) throws IllegalArgumentException, IndexOutOfBoundsException Copied from Google Guava under Apache License v2.0 and may be modified.
Ensures thatindexspecifies a valid position in an array, list or string of sizesize. A position index may range from zero tosize, inclusive.- Parameters:
index- a user-supplied index identifying a position in an array, list or stringsize- the size of that array, list or stringdesc- the text to use to describe this index in an error message- Returns:
- the value of
index - Throws:
IllegalArgumentException- ifsizeis negativeIndexOutOfBoundsException- ifindexis negative or is greater thansize
-
checkArgNotNull
Checks if the specified argument is notnull, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument- Parameters:
obj- the argument to check- Returns:
- the
non-nullargument - Throws:
IllegalArgumentException- if the argument is null
-
checkArgNotNull
Checks if the specified argument is notnull, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument- Parameters:
obj- the argument to checkerrorMessage- the error message to use in the exception- Returns:
- the
non-nullargument - Throws:
IllegalArgumentException- if the argument is null
-
checkArgNotEmpty
public static <T extends CharSequence> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified charSequence argument isnullor empty, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument, which extends CharSequence- Parameters:
arg- the argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static boolean[] checkArgNotEmpty(boolean[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified boolean array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the boolean array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty boolean array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static char[] checkArgNotEmpty(char[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified char array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the char array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty char array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static byte[] checkArgNotEmpty(byte[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified byte array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the byte array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty byte array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static short[] checkArgNotEmpty(short[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified short array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the short array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty short array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static int[] checkArgNotEmpty(int[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified int array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the int array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty int array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static long[] checkArgNotEmpty(long[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified long array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the long array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty long array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static float[] checkArgNotEmpty(float[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified float array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the float array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty float array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static double[] checkArgNotEmpty(double[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified double array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the double array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty double array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static <T> T[] checkArgNotEmpty(T[] arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified Object array argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument- Parameters:
arg- the Object array argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty Object array argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static <T extends Collection<?>> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified collection argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the boolean collection argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty boolean collection argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
@Beta public static <T extends Iterable<?>> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified Iterable argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the Iterable argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty Iterable argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
@Beta public static <T extends Iterator<?>> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified Iterator argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the Iterator argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty Iterator argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static <T extends Map<?,?>> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified Map argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument- Parameters:
arg- the Map argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty Map argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static <T extends PrimitiveList<?,?, T checkArgNotEmpty?>> (T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified PrimitiveList argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument- Parameters:
arg- the PrimitiveList argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty PrimitiveList argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static <T> Multiset<T> checkArgNotEmpty(Multiset<T> arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified Multiset argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument- Parameters:
arg- the Multiset argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty Multiset argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static <T extends Multimap<?,?, T checkArgNotEmpty?>> (T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified Multimap argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument- Parameters:
arg- the Multimap argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty Multimap argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotEmpty
public static <T extends DataSet> T checkArgNotEmpty(T arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified DataSet argument is notnullor empty, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument- Parameters:
arg- the DataSet argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty DataSet argument - Throws:
IllegalArgumentException- if the argument isnullor empty
-
checkArgNotBlank
public static <T extends CharSequence> T checkArgNotBlank(T arg, String msg) throws IllegalArgumentException Checks if the specified charSequence argument is notnullor empty or blank, and throwsIllegalArgumentExceptionif it is.- Type Parameters:
T- the type of the argument, which extends CharSequence- Parameters:
arg- the argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the
non-nulland non-empty and non-blank argument - Throws:
IllegalArgumentException- if the argument isnullor empty or blank
-
checkArgNotNegative
public static byte checkArgNotNegative(byte arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified byte argument is not negative, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the byte argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the non-negative byte argument
- Throws:
IllegalArgumentException- if the specified arg is negative
-
checkArgNotNegative
public static short checkArgNotNegative(short arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified short argument is not negative, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the short argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the non-negative short argument
- Throws:
IllegalArgumentException- if the specified arg is negative
-
checkArgNotNegative
public static int checkArgNotNegative(int arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified int argument is not negative, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the int argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the non-negative int argument
- Throws:
IllegalArgumentException- if the specified arg is negative
-
checkArgNotNegative
public static long checkArgNotNegative(long arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified long argument is not negative, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the long argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the non-negative long argument
- Throws:
IllegalArgumentException- if the specified arg is negative
-
checkArgNotNegative
public static float checkArgNotNegative(float arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified float argument is not negative, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the float argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the non-negative float argument
- Throws:
IllegalArgumentException- if the specified arg is negative
-
checkArgNotNegative
public static double checkArgNotNegative(double arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified double argument is not negative, and throwsIllegalArgumentExceptionif it is.- Parameters:
arg- the double argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the non-negative double argument
- Throws:
IllegalArgumentException- if the specified arg is negative
-
checkArgPositive
public static byte checkArgPositive(byte arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified byte argument is positive, and throwsIllegalArgumentExceptionif it is not.- Parameters:
arg- the byte argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the positive byte argument
- Throws:
IllegalArgumentException- if the specified arg is not positive
-
checkArgPositive
public static short checkArgPositive(short arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified short argument is positive, and throwsIllegalArgumentExceptionif it is not.- Parameters:
arg- the short argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the positive short argument
- Throws:
IllegalArgumentException- if the specified arg is not positive
-
checkArgPositive
public static int checkArgPositive(int arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified int argument is positive, and throwsIllegalArgumentExceptionif it is not.- Parameters:
arg- the int argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the positive int argument
- Throws:
IllegalArgumentException- if the specified arg is not positive
-
checkArgPositive
public static long checkArgPositive(long arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified long argument is positive, and throwsIllegalArgumentExceptionif it is not.- Parameters:
arg- the long argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the positive long argument
- Throws:
IllegalArgumentException- if the specified arg is not positive
-
checkArgPositive
public static float checkArgPositive(float arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified float argument is positive, and throwsIllegalArgumentExceptionif it is not.- Parameters:
arg- the float argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the positive float argument
- Throws:
IllegalArgumentException- if the specified arg is not positive
-
checkArgPositive
public static double checkArgPositive(double arg, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified double argument is positive, and throwsIllegalArgumentExceptionif it is not.- Parameters:
arg- the double argument to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Returns:
- the positive double argument
- Throws:
IllegalArgumentException- if the specified arg is not positive
-
checkElementNotNull
Checks if the specified array not contains anynullelement, and throwsIllegalArgumentExceptionif it does.- Parameters:
a- the array to check- Throws:
IllegalArgumentException- if anullelement is found in the array
-
checkElementNotNull
public static void checkElementNotNull(Object[] a, String argNameOrErrorMsg) throws IllegalArgumentException Checks if the specified array not contains anynullelement, and throwsIllegalArgumentExceptionif it does.- Parameters:
a- the array to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Throws:
IllegalArgumentException- if anullelement is found in the array
-
checkElementNotNull
Check if the specifiedCollectionnot contains anynullelement, and throwsIllegalArgumentExceptionif it does.- Parameters:
c- the collection to check- Throws:
IllegalArgumentException- ifnullelement found inc
-
checkElementNotNull
public static void checkElementNotNull(Collection<?> c, String argNameOrErrorMsg) throws IllegalArgumentException Check if the specifiedCollectionnot contains anynullelement, and throwsIllegalArgumentExceptionif it does.- Parameters:
c- the collection to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Throws:
IllegalArgumentException- ifnullelement found inc
-
checkKeyNotNull
Check if the specifiedMapnot contains anynullkey, and throwsIllegalArgumentExceptionif it does.- Parameters:
m- the map to check- Throws:
IllegalArgumentException- ifnullkey found inm
-
checkKeyNotNull
public static void checkKeyNotNull(Map<?, ?> m, String argNameOrErrorMsg) throws IllegalArgumentExceptionCheck if the specifiedMapnot contains anynullkey, and throwsIllegalArgumentExceptionif it does.- Parameters:
m- the map to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Throws:
IllegalArgumentException- ifnullkey found inm
-
checkValueNotNull
Check if the specifiedMapnot contains anynullvalue, and throwsIllegalArgumentExceptionif it does.- Parameters:
m- the map to check- Throws:
IllegalArgumentException- ifnullvalue found inm
-
checkValueNotNull
public static void checkValueNotNull(Map<?, ?> m, String argNameOrErrorMsg) throws IllegalArgumentExceptionCheck if the specifiedMapnot contains anynullvalue, and throwsIllegalArgumentExceptionif it does.- Parameters:
m- the map to checkargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Throws:
IllegalArgumentException- ifnullvalue found inm
-
checkArgument
Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
expression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean expression, Object errorMessage) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
expression- a boolean expressionargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
expression- a boolean expressionerrorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.errorMessageArgs- the arguments to be substituted into the message template. Arguments are converted to strings usingString.valueOf(Object).- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, char p) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, char p1, char p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, char p1, int p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, char p1, long p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, char p1, double p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, char p1, Object p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p1, char p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p1, int p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p1, long p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p1, double p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, int p1, Object p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p1, char p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p1, int p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p1, long p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p1, double p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, long p1, Object p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p1, char p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p1, int p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p1, long p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p1, double p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, double p1, Object p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, char p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, int p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, long p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, double p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, Object p2) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messagep3- the third parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3, Object p4) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messagep3- the third parameter to be used in the exception messagep4- the third parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkArgument
public static void checkArgument(boolean b, Supplier<String> errorMessageSupplier) throws IllegalArgumentException Check if the specifiedexpressioninvolving one or more parameters of the calling method istrue, and throwsIllegalArgumentExceptionif it is not.- Parameters:
errorMessageSupplier- a supplier of the exception message to use if the check fails; will not be invoked if the check passesexpression- a boolean expression- Throws:
IllegalArgumentException- ifexpressionis false
-
checkState
Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
expression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
expression- a boolean expressionargNameOrErrorMsg- the name of the argument or an error message to be used in the exception- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
expression- a boolean expressionerrorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.errorMessageArgs- the arguments to be substituted into the message template. Arguments are converted to strings usingString.valueOf(Object).- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, char p) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, int p) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, long p) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, double p) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p- the parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, char p1, char p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, char p1, int p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, char p1, long p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, char p1, double p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, char p1, Object p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, int p1, char p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, int p1, int p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, int p1, long p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, int p1, double p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, int p1, Object p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, long p1, char p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, long p1, int p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, long p1, long p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, long p1, double p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, long p1, Object p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, double p1, char p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, double p1, int p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, double p1, long p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, double p1, double p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, double p1, Object p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p1, char p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p1, int p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p2- the second parameter to be used in the exception messageexpression- a boolean expressionp- the parameter to be used in the exception message- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p1, long p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p1, double p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p1, Object p2) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messagep3- the third parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, String errorMessageTemplate, Object p1, Object p2, Object p3, Object p4) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageTemplate- a template for the exception message should the check fail. The message is formed by replacing each {} or %s placeholder in the template with an argument.p1- the parameter to be used in the exception messagep2- the second parameter to be used in the exception messagep3- the third parameter to be used in the exception messagep4- the third parameter to be used in the exception messageexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
checkState
public static void checkState(boolean b, Supplier<String> errorMessageSupplier) throws IllegalStateException Check if the specifiedexpressioninvolving the state check of the calling instance istrue, and throwsIllegalStateExceptionif it is not.- Parameters:
errorMessageSupplier- a supplier of the exception message to use if the check fails; will not be invoked if the check passesexpression- a boolean expression- Throws:
IllegalStateException- ifexpressionis false
-
requireNonNull
Checks if the specified object reference is notnull, and throwsNullPointerExceptionif it is.- Type Parameters:
T- the type of the object- Parameters:
obj- the object reference to check for nullity- Returns:
- the
non-nullobject reference that was validated - Throws:
NullPointerException- if the specifiedobjisnull- See Also:
-
requireNonNull
Checks if the specified object reference is notnull, and throwsNullPointerExceptionif it is.- Type Parameters:
T- the type of the object- Parameters:
obj- the object reference to check for nullityerrorMessage- the detail message to be used in the event that aNullPointerExceptionis thrown- Returns:
- the
non-nullobject reference that was validated - Throws:
NullPointerException- if the specifiedobjisnull- See Also:
-
requireNonNull
@Beta public static <T> T requireNonNull(T obj, Supplier<String> errorMessageSupplier) throws NullPointerException Checks if the specified object reference is notnull, and throwsNullPointerExceptionif it is.- Type Parameters:
T- the type of the object- Parameters:
obj- the object reference to check for nullityerrorMessageSupplier- the supplier of the detail message to be used in the event that aNullPointerExceptionis thrown- Returns:
- the
non-nullobject reference that was validated - Throws:
NullPointerException- if the specifiedobjisnull- See Also:
-
compare
public static int compare(boolean a, boolean b) Compares two boolean values.- Parameters:
a- the first boolean valueb- the second boolean value- Returns:
- 0 if both values are equal, 1 if the first value is
trueand the second isfalse, -1 if the first value isfalseand the second is true
-
compare
public static int compare(char a, char b) Compares two char values.- Parameters:
a- the first char valueb- the second char value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compare
public static int compare(byte a, byte b) Compares two byte values.- Parameters:
a- the first byte valueb- the second byte value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compareUnsigned
public static int compareUnsigned(byte a, byte b) Compares two unsigned byte values.- Parameters:
a- the first byte valueb- the second byte value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
- See Also:
-
compare
public static int compare(short a, short b) Compares two short values.- Parameters:
a- the first short valueb- the second short value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compareUnsigned
public static int compareUnsigned(short a, short b) Compares two unsigned short values.- Parameters:
a- the first short valueb- the second short value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
- See Also:
-
compare
public static int compare(int a, int b) Compares two int values.- Parameters:
a- the first int valueb- the second int value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compareUnsigned
public static int compareUnsigned(int a, int b) Compares two unsigned int values.- Parameters:
a- the first int valueb- the second int value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
- See Also:
-
compare
public static int compare(long a, long b) Compares two long values.- Parameters:
a- the first long valueb- the second long value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compareUnsigned
public static int compareUnsigned(long a, long b) Compares two unsigned long values.- Parameters:
a- the first long valueb- the second long value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
- See Also:
-
compare
public static int compare(float a, float b) Compares two float values.- Parameters:
a- the first float valueb- the second float value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compare
public static int compare(double a, double b) Compares two double values.- Parameters:
a- the first double valueb- the second double value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compare
Compares twoComparableobject values. (nullis considered as the smallest value in nature order).- Parameters:
a- the first object valueb- the second object value- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compare
Compares twoComparableobject values using the specifiedComparator.- Type Parameters:
T-- Parameters:
a- the first object valueb- the second object valuecmp- the comparator to be used- Returns:
- 0 if both values are equal, 1 if the first value is greater than the second, -1 if the first value is less than the second
-
compare
public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>> int compare(T1 a1, T1 b1, T2 a2, T2 b2) Compares two pairs of values (a1, b1) and (a2, b2) until they are not equal. (nullis considered as the smallest value in nature order). Returns 0 if all pairs of values are equal.- Type Parameters:
T1- the type of the first pair of values, which must be comparableT2- the type of the second pair of values, which must be comparable- Parameters:
a1- the first value of the first pairb1- the second value of the first paira2- the first value of the second pairb2- the second value of the second pair- Returns:
- a negative integer, zero, or a positive integer as the first value is less than, equal to, or greater than the second values in the specified pairs.
-
compare
public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3) Compares three pairs of values (a1, b1), (a2, b2), and (a3, b3) until they are not equal. (nullis considered as the smallest value in nature order). Returns 0 if all pairs of values are equal.- Type Parameters:
T1- the type of the first pair of values, which must be comparableT2- the type of the second pair of values, which must be comparableT3- the type of the third pair of values, which must be comparable- Parameters:
a1- the first value of the first pairb1- the second value of the first paira2- the first value of the second pairb2- the second value of the second paira3- the first value of the third pairb3- the second value of the third pair- Returns:
- a negative integer, zero, or a positive integer as the first value is less than, equal to, or greater than the second values in the specified pairs.
-
compare
@Deprecated public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>, T4 extends Comparable<T4>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4) Deprecated.replaced byBuilder.compare(Comparable, Comparable)Compares four pairs of values (a1, b1), (a2, b2), (a3, b3), and (a4, b4) until they are not equal. (nullis considered as the smallest value in nature order). Returns 0 if all pairs of values are equal.- Type Parameters:
T1- the type of the first pair of values, which must be comparableT2- the type of the second pair of values, which must be comparableT3- the type of the third pair of values, which must be comparableT4- the type of the fourth pair of values, which must be comparable- Parameters:
a1- the first value of the first pairb1- the second value of the first paira2- the first value of the second pairb2- the second value of the second paira3- the first value of the third pairb3- the second value of the third paira4- the first value of the fourth pairb4- the second value of the fourth pair- Returns:
- a negative integer, zero, or a positive integer as the first value is less than, equal to, or greater than the second values in the specified pairs.
- See Also:
-
compare
@Deprecated public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5) Deprecated.replaced byBuilder.compare(Comparable, Comparable)Compares five pairs of values (a1, b1), (a2, b2), (a3, b3), (a4, b4), and (a5, b5) until they are not equal. (nullis considered as the smallest value in nature order). Returns 0 if all pairs of values are equal.- Type Parameters:
T1- the type of the first pair of values, which must be comparableT2- the type of the second pair of values, which must be comparableT3- the type of the third pair of values, which must be comparableT4- the type of the fourth pair of values, which must be comparableT5- the type of the fifth pair of values, which must be comparable- Parameters:
a1- the first value of the first pairb1- the second value of the first paira2- the first value of the second pairb2- the second value of the second paira3- the first value of the third pairb3- the second value of the third paira4- the first value of the fourth pairb4- the second value of the fourth paira5- the first value of the fifth pairb5- the second value of the fifth pair- Returns:
- a negative integer, zero, or a positive integer as the first value is less than, equal to, or greater than the second values in the specified pairs.
- See Also:
-
compare
@Deprecated public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>, T6 extends Comparable<T6>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5, T6 a6, T6 b6) Deprecated.replaced byBuilder.compare(Comparable, Comparable)Compares six pairs of values (a1, b1), (a2, b2), (a3, b3), (a4, b4), (a5, b5), and (a6, b6) until they are not equal. (nullis considered as the smallest value in nature order). Returns 0 if all pairs of values are equal.- Type Parameters:
T1- the type of the first pair of values, which must be comparableT2- the type of the second pair of values, which must be comparableT3- the type of the third pair of values, which must be comparableT4- the type of the fourth pair of values, which must be comparableT5- the type of the fifth pair of values, which must be comparableT6- the type of the sixth pair of values, which must be comparable- Parameters:
a1- the first value of the first pairb1- the second value of the first paira2- the first value of the second pairb2- the second value of the second paira3- the first value of the third pairb3- the second value of the third paira4- the first value of the fourth pairb4- the second value of the fourth paira5- the first value of the fifth pairb5- the second value of the fifth paira6- the first value of the sixth pairb6- the second value of the sixth pair- Returns:
- a negative integer, zero, or a positive integer as the first value is less than, equal to, or greater than the second values in the specified pairs.
- See Also:
-
compare
@Deprecated public static <T1 extends Comparable<T1>,T2 extends Comparable<T2>, int compareT3 extends Comparable<T3>, T4 extends Comparable<T4>, T5 extends Comparable<T5>, T6 extends Comparable<T6>, T7 extends Comparable<T7>> (T1 a1, T1 b1, T2 a2, T2 b2, T3 a3, T3 b3, T4 a4, T4 b4, T5 a5, T5 b5, T6 a6, T6 b6, T7 a7, T7 b7) Deprecated.replaced byBuilder.compare(Comparable, Comparable)Compares seven pairs of values (a1, b1), (a2, b2), (a3, b3), (a4, b4), (a5, b5), (a6, b6), and (a7, b7) until they are not equal. (nullis considered as the smallest value in nature order). Returns 0 if all pairs of values are equal.- Type Parameters:
T1- the type of the first pair of values, which must be comparableT2- the type of the second pair of values, which must be comparableT3- the type of the third pair of values, which must be comparableT4- the type of the fourth pair of values, which must be comparableT5- the type of the fifth pair of values, which must be comparableT6- the type of the sixth pair of values, which must be comparableT7- the type of the seventh pair of values, which must be comparable- Parameters:
a1- the first value of the first pairb1- the second value of the first paira2- the first value of the second pairb2- the second value of the second paira3- the first value of the third pairb3- the second value of the third paira4- the first value of the fourth pairb4- the second value of the fourth paira5- the first value of the fifth pairb5- the second value of the fifth paira6- the first value of the sixth pairb6- the second value of the sixth paira7- the first value of the seventh pairb7- the second value of the seventh pair- Returns:
- a negative integer, zero, or a positive integer as the first value is less than, equal to, or greater than the second values in the specified pairs
- See Also:
-
compare
public static int compare(boolean[] a, boolean[] b) Compares two arrays lexicographically.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compare
public static int compare(char[] a, char[] b) Compares two arrays lexicographically.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compare
public static int compare(byte[] a, byte[] b) Compares two arrays lexicographically.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compareUnsigned
public static int compareUnsigned(byte[] a, byte[] b) Compares two arrays lexicographically, treating the values as unsigned.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
- See Also:
-
compareUnsigned
public static int compareUnsigned(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two subarrays lexicographically, treating the values as unsigned.- Parameters:
a- the first array to comparefromIndexA- the starting index (inclusive) of the first subarrayb- the second array to comparefromIndexB- the starting index (inclusive) of the second subarraylen- the length of the subarrays to compare- Returns:
- a negative integer, zero, or a positive integer as the first subarray is less than, equal to, or greater than the second subarray
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified indices are out of bounds- See Also:
-
compare
public static int compare(short[] a, short[] b) Compares two arrays lexicographically.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compareUnsigned
public static int compareUnsigned(short[] a, short[] b) Compares two arrays lexicographically, treating the values as unsigned.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
- See Also:
-
compareUnsigned
public static int compareUnsigned(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two subarrays lexicographically, treating the values as unsigned.- Parameters:
a- the first array to comparefromIndexA- the starting index (inclusive) of the first subarrayb- the second array to comparefromIndexB- the starting index (inclusive) of the second subarraylen- the length of the subarrays to compare- Returns:
- a negative integer, zero, or a positive integer as the first subarray is less than, equal to, or greater than the second subarray
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified indices are out of bounds- See Also:
-
compare
public static int compare(int[] a, int[] b) Compares two arrays lexicographically.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compareUnsigned
public static int compareUnsigned(int[] a, int[] b) Compares two arrays lexicographically, treating the values as unsigned.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
- See Also:
-
compareUnsigned
public static int compareUnsigned(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two subarrays lexicographically, treating the values as unsigned.- Parameters:
a- the first array to comparefromIndexA- the starting index (inclusive) of the first subarrayb- the second array to comparefromIndexB- the starting index (inclusive) of the second subarraylen- the length of the subarrays to compare- Returns:
- a negative integer, zero, or a positive integer as the first subarray is less than, equal to, or greater than the second subarray
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified indices are out of bounds- See Also:
-
compare
public static int compare(long[] a, long[] b) Compares two arrays lexicographically.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compareUnsigned
public static int compareUnsigned(long[] a, long[] b) Compares two arrays lexicographically, treating the values as unsigned.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
- See Also:
-
compareUnsigned
public static int compareUnsigned(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two subarrays lexicographically, treating the values as unsigned.- Parameters:
a- the first array to comparefromIndexA- the starting index (inclusive) of the first subarrayb- the second array to comparefromIndexB- the starting index (inclusive) of the second subarraylen- the length of the subarrays to compare- Returns:
- a negative integer, zero, or a positive integer as the first subarray is less than, equal to, or greater than the second subarray
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified indices are out of bounds- See Also:
-
compare
public static int compare(float[] a, float[] b) Compares two arrays lexicographically.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compare
public static int compare(double[] a, double[] b) Compares two arrays lexicographically.- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static int compare(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compare
Compares two arrays lexicographically. (nullis considered as the smallest value in nature order).- Parameters:
a- the first array to compareb- the second array to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second
-
compare
public static <T extends Comparable<? super T>> int compare(T[] a, int fromIndexA, T[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range. (nullis considered as the smallest value in nature order).- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compare
Compares two arrays using the specified comparator.- Type Parameters:
T- the type of elements in the arrays- Parameters:
a- the first array to compareb- the second array to comparecmp- the comparator to compare array elements- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
-
compare
public static <T> int compare(T[] a, int fromIndexA, T[] b, int fromIndexB, int len, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays lexicographically over the specified range using the specified comparator.- Parameters:
a- the first array to comparefromIndexA- the starting index in the first arrayb- the second array to comparefromIndexB- the starting index in the second arraylen- the number of elements to comparecmp- the comparator to compare array elements- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compare
public static <T> int compare(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two collections lexicographically over the specified range. (nullis considered as the smallest value in nature order).- Parameters:
a- the first collection to comparefromIndexA- the starting index in the first collectionb- the second collection to comparefromIndexB- the starting index in the second collectionlen- the number of elements to compare- Returns:
- a negative integer, zero, or a positive integer as the first collection is less than, equal to, or greater than the second collection
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified ranges are out of bounds
-
compare
Compares two iterables lexicographically. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of elements in the iterables, which must be comparable- Parameters:
a- the first iterable to compareb- the second iterable to compare- Returns:
- a negative integer, zero, or a positive integer as the first iterable is less than, equal to, or greater than the second iterable
-
compare
Compares two iterators lexicographically. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of elements in the iterators, which must be comparable- Parameters:
a- the first iterator to compareb- the second iterator to compare- Returns:
- a negative integer, zero, or a positive integer as the first iterator is less than, equal to, or greater than the second iterator
-
compare
public static <T> int compare(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Compares two collections lexicographically over the specified range using the specified comparator.- Type Parameters:
T- the type of elements in the collections- Parameters:
a- the first collection to comparefromIndexA- the starting index in the first collectionb- the second collection to comparefromIndexB- the starting index in the second collectionlen- the number of elements to comparecmp- the comparator to compare collection elements- Returns:
- a negative integer, zero, or a positive integer as the first collection is less than, equal to, or greater than the second collection
- Throws:
IllegalArgumentException- if the specified length is negativeIndexOutOfBoundsException- if the specified indices are out of range
-
compare
Compares two iterables using the specified comparator.- Type Parameters:
T- the type of elements in the iterables- Parameters:
a- the first iterable to compareb- the second iterable to comparecmp- the comparator to compare elements from iterables- Returns:
- a negative integer, zero, or a positive integer as the first iterable is less than, equal to, or greater than the second iterable
-
compare
Compares two iterators using the specified comparator.- Type Parameters:
T- the type of elements in the iterators- Parameters:
a- the first iterator to compareb- the second iterator to comparecmp- the comparator to compare elements from iterators- Returns:
- a negative integer, zero, or a positive integer as the first iterator is less than, equal to, or greater than the second iterator
-
compareIgnoreCase
Compares two strings lexicographically, ignoring case differences.- Parameters:
a- the first string to compareb- the second string to compare- Returns:
- a negative integer, zero, or a positive integer as the first string is less than, equal to, or greater than the second string, ignoring case considerations
-
compareIgnoreCase
Compares two arrays of strings lexicographically, ignoring case differences.- Parameters:
a- the first array of strings to compareb- the second array of strings to compare- Returns:
- a negative integer, zero, or a positive integer as the first array is less than, equal to, or greater than the second array, ignoring case considerations
-
compareByProps
@Deprecated public static int compareByProps(@NotNull Object bean1, @NotNull Object bean2, Collection<String> propNamesToCompare) Deprecated.callgetPropValueby reflection APIs during comparing or sorting may have a huge impact on performance. UseBuilder.ComparisonBuilderinstead.Compares two beans based on the specified properties.- Parameters:
bean1- the first bean to compare, must not be nullbean2- the second bean to compare, must not be nullpropNamesToCompare- the collection of property names to compare, may be null- Returns:
- a negative integer, zero, or a positive integer as the first bean is less than, equal to, or greater than the second bean
- Throws:
IllegalArgumentException- if any of the arguments are null- See Also:
-
mismatch
public static int mismatch(boolean[] a, boolean[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Parameters:
a- the first boolean arrayb- the second boolean array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static int mismatch(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two boolean arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first boolean arrayfromIndexA- the starting index in the first arrayb- the second boolean arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(char[] a, char[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Parameters:
a- the first char arrayb- the second char array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static int mismatch(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two char arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first char arrayfromIndexA- the starting index in the first arrayb- the second char arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(byte[] a, byte[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Parameters:
a- the first byte arrayb- the second byte array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static int mismatch(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two byte arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first byte arrayfromIndexA- the starting index in the first arrayb- the second byte arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(short[] a, short[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Parameters:
a- the first short arrayb- the second short array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static int mismatch(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two short arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first short arrayfromIndexA- the starting index in the first arrayb- the second short arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(int[] a, int[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Parameters:
a- the first int arrayb- the second int array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static int mismatch(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two int arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first int arrayfromIndexA- the starting index in the first arrayb- the second int arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(long[] a, long[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Parameters:
a- the first long arrayb- the second long array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static int mismatch(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two long arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first long arrayfromIndexA- the starting index in the first arrayb- the second long arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(float[] a, float[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Parameters:
a- the first float arrayb- the second float array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static int mismatch(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two float arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first float arrayfromIndexA- the starting index in the first arrayb- the second float arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static int mismatch(double[] a, double[] b) Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Parameters:
a- the first double arrayb- the second double array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static int mismatch(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two double arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first double arrayfromIndexA- the starting index in the first arrayb- the second double arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Type Parameters:
T- the type of elements in the arrays, which must be Comparable- Parameters:
a- the first arrayb- the second array- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static <T extends Comparable<? super T>> int mismatch(T[] a, int fromIndexA, T[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first arrayfromIndexA- the starting index in the first arrayb- the second arrayfromIndexB- the starting index in the second arraylen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
Finds and returns the index of the first mismatch between two arrays. If the arrays are identical or both arenullor empty, returns -1.- Type Parameters:
T- the type of elements in the arrays, which must be Comparable- Parameters:
a- the first arrayb- the second arraycmp- the comparator to compare array elements- Returns:
- the index of the first mismatch, or -1 if the arrays are identical or both are
nullor empty. - See Also:
-
mismatch
public static <T> int mismatch(T[] a, int fromIndexA, T[] b, int fromIndexB, int len, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two arrays starting from specified indices. If the arrays are identical in the specified range, returns -1.- Parameters:
a- the first arrayfromIndexA- the starting index in the first arrayb- the second arrayfromIndexB- the starting index in the second arraylen- the number of elements to comparecmp- the comparator to compare array elements- Returns:
- the index of the first mismatch, or -1 if the arrays are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
public static <T> int mismatch(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two collections starting from specified indices. If the collections are identical in the specified range, returns -1.- Type Parameters:
T- the type of elements in the collections- Parameters:
a- the first collectionfromIndexA- the starting index in the first collectionb- the second collectionfromIndexB- the starting index in the second collectionlen- the number of elements to compare- Returns:
- the index of the first mismatch, or -1 if the collections are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
Finds and returns the index of the first mismatch between two iterables. If the iterables are identical or both arenullor empty, returns -1.- Type Parameters:
T- the type of elements in the iterables- Parameters:
a- the first iterableb- the second iterable- Returns:
- the index of the first mismatch, or -1 if the iterables are identical or both are
nullor empty - See Also:
-
mismatch
Finds and returns the index of the first mismatch between two iterators. If the iterators are identical or both arenullor empty, returns -1.- Type Parameters:
T- the type of elements in the iterators- Parameters:
a- the first iteratorb- the second iterator- Returns:
- the index of the first mismatch, or -1 if the iterators are identical or both are
nullor empty - See Also:
-
mismatch
public static <T> int mismatch(Collection<T> a, int fromIndexA, Collection<T> b, int fromIndexB, int len, Comparator<? super T> cmp) throws IllegalArgumentException, IndexOutOfBoundsException Finds and returns the index of the first mismatch between two collections starting from specified indices. If the collections are identical in the specified range, returns -1.- Type Parameters:
T- the type of elements in the collections- Parameters:
a- the first collectionfromIndexA- the starting index in the first collectionb- the second collectionfromIndexB- the starting index in the second collectionlen- the number of elements to comparecmp- the comparator to compare elements- Returns:
- the index of the first mismatch, or -1 if the collections are identical in the specified range
- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the starting indices or length are out of bounds- See Also:
-
mismatch
Finds and returns the index of the first mismatch between two iterables using the specified comparator. If the iterables are identical or both arenullor empty, returns -1.- Type Parameters:
T- the type of elements in the iterables- Parameters:
a- the first iterableb- the second iterablecmp- the comparator to compare elements- Returns:
- the index of the first mismatch, or -1 if the iterables are identical or both are
nullor empty - See Also:
-
mismatch
Finds and returns the index of the first mismatch between two iterators using the specified comparator. If the iterators are identical or both arenullor empty, returns -1.- Type Parameters:
T- the type of elements in the iterators- Parameters:
a- the first iteratorb- the second iteratorcmp- the comparator to compare elements- Returns:
- the index of the first mismatch, or -1 if the iterators are identical or both are
nullor empty - See Also:
-
lessThan
Compares two comparable objects to determine if the first is less than the second. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
a- the first object to compare, must not be nullb- the second object to compare, must not be null- Returns:
trueif the first object is less than the second,falseotherwise
-
lessThan
Compares two objects using the specified comparator to determine if the first is less than the second.- Type Parameters:
T- the type of the objects being compared- Parameters:
a- the first object to compare, must not be nullb- the second object to compare, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the first object is less than the second,falseotherwise
-
lessEqual
Compares two comparable objects to determine if the first is less than or equal to the second. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
a- the first object to compare, must not be nullb- the second object to compare, must not be null- Returns:
trueif the first object is less than or equal to the second,falseotherwise
-
lessEqual
Compares two objects using the specified comparator to determine if the first is less than or equal to the second.- Type Parameters:
T- the type of the objects being compared- Parameters:
a- the first object to compare, must not be nullb- the second object to compare, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the first object is less than or equal to the second,falseotherwise
-
greaterThan
Compares two comparable objects to determine if the first is greater than the second. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
a- the first object to compare, must not be nullb- the second object to compare, must not be null- Returns:
trueif the first object is greater than the second,falseotherwise
-
greaterThan
Compares two objects using the specified comparator to determine if the first is greater than the second.- Type Parameters:
T- the type of the objects being compared- Parameters:
a- the first object to compare, must not be nullb- the second object to compare, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the first object is greater than the second,falseotherwise
-
greaterEqual
Compares two comparable objects to determine if the first is greater than or equal to the second. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
a- the first object to compare, must not be nullb- the second object to compare, must not be null- Returns:
trueif the first object is greater than or equal to the second,falseotherwise
-
greaterEqual
Compares two objects using the specified comparator to determine if the first is greater than or equal to the second.- Type Parameters:
T- the type of the objects being compared- Parameters:
a- the first object to compare, must not be nullb- the second object to compare, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the first object is greater than or equal to the second,falseotherwise
-
gtAndLt
Checks if the given value is greater than the minimum value and less than the maximum value. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be null- Returns:
trueif the value is greater than the minimum and less than the maximum,falseotherwise
-
gtAndLt
Checks if the given value is greater than the minimum value and less than the maximum value using the specified comparator.- Type Parameters:
T- the type of the objects being compared- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the value is greater than the minimum and less than the maximum,falseotherwise
-
geAndLt
Checks if the given value is greater than or equal to the minimum value and less than the maximum value. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be null- Returns:
trueif the value is greater than or equal to the minimum and less than the maximum,falseotherwise
-
geAndLt
Checks if the given value is greater than or equal to the minimum value and less than the maximum value using the specified comparator.- Type Parameters:
T- the type of the objects being compared- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the value is greater than or equal to the minimum and less than the maximum,falseotherwise
-
geAndLe
Checks if the given value is greater than or equal to the minimum value and less than or equal to the maximum value. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be null- Returns:
trueif the value is greater than or equal to the minimum and less than or equal to the maximum,falseotherwise
-
geAndLe
Checks if the given value is greater than or equal to the minimum value and less than or equal to the maximum value using the specified comparator.- Type Parameters:
T- the type of the objects being compared- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the value is greater than or equal to the minimum and less than or equal to the maximum,falseotherwise
-
gtAndLe
Checks if the given value is greater than the minimum value and less than or equal to the maximum value. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be null- Returns:
trueif the value is greater than the minimum and less than or equal to the maximum,falseotherwise
-
gtAndLe
Checks if the given value is greater than the minimum value and less than or equal to the maximum value using the specified comparator.- Type Parameters:
T- the type of the objects being compared- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the value is greater than the minimum and less than or equal to the maximum,falseotherwise
-
isBetween
@Deprecated public static <T extends Comparable<? super T>> boolean isBetween(T value, T min, T max) Deprecated.replaced bygtAndLt(Comparable, Comparable, Comparable)Checks if the given value is greater than the minimum value and less than the maximum value. (nullis considered as the smallest value in nature order).- Type Parameters:
T- the type of the objects being compared, which must be comparable- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be null- Returns:
trueif the value is greater than the minimum and less than the maximum,falseotherwise- See Also:
-
isBetween
Deprecated.replaced bygtAndLt(Comparable, Comparable, Comparable, Comparator)Checks if the given value is greater than the minimum value and less than the maximum value using the specified comparator.- Type Parameters:
T- the type of the objects being compared- Parameters:
value- the value to check, must not be nullmin- the minimum value, must not be nullmax- the maximum value, must not be nullcmp- the comparator to use for comparison, ifnull, the natural ordering of the objects will be used- Returns:
trueif the value is greater than the minimum and less than the maximum,falseotherwise- See Also:
-
equals
public static boolean equals(boolean a, boolean b) Compares two boolean values for equality.- Parameters:
a- the first boolean valueb- the second boolean value- Returns:
trueif the boolean values are equal,falseotherwise
-
equals
public static boolean equals(char a, char b) Compares two char values for equality.- Parameters:
a- the first char valueb- the second char value- Returns:
trueif the char values are equal,falseotherwise
-
equals
public static boolean equals(byte a, byte b) Compares two byte values for equality.- Parameters:
a- the first byte valueb- the second byte value- Returns:
trueif the byte values are equal,falseotherwise
-
equals
public static boolean equals(short a, short b) Compares two short values for equality.- Parameters:
a- the first short valueb- the second short value- Returns:
trueif the short values are equal,falseotherwise
-
equals
public static boolean equals(int a, int b) Compares two int values for equality.- Parameters:
a- the first int valueb- the second int value- Returns:
trueif the int values are equal,falseotherwise
-
equals
public static boolean equals(long a, long b) Compares two long values for equality.- Parameters:
a- the first long valueb- the second long value- Returns:
trueif the long values are equal,falseotherwise
-
equals
public static boolean equals(float a, float b) Compares two float values for equality.- Parameters:
a- the first float valueb- the second float value- Returns:
trueif the float values are equal,falseotherwise
-
equals
public static boolean equals(double a, double b) Compares two double values for equality.- Parameters:
a- the first double valueb- the second double value- Returns:
trueif the double values are equal,falseotherwise
-
equals
Compares two strings for equality.- Parameters:
a- the first stringb- the second string- Returns:
trueif the strings are equal,falseotherwise
-
equalsIgnoreCase
Compares two strings for equality, ignoring case.- Parameters:
a- the first stringb- the second string- Returns:
trueif the strings are equal,falseotherwise
-
equals
Compares two objects for equality. If the objects are arrays, the appropriateArrays.equalsmethod will be used.- Parameters:
a- the first objectb- the second object- Returns:
trueif the objects are equal,falseotherwise
-
equals
public static boolean equals(boolean[] a, boolean[] b) Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(boolean[] a, int fromIndexA, boolean[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two boolean arrays for equality within the specified range.- Parameters:
a- the first boolean array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second boolean array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equals
public static boolean equals(char[] a, char[] b) Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(char[] a, int fromIndexA, char[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two char arrays for equality within the specified range.- Parameters:
a- the first char array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second char array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equals
public static boolean equals(byte[] a, byte[] b) Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(byte[] a, int fromIndexA, byte[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two byte arrays for equality within the specified range.- Parameters:
a- the first byte array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second byte array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equals
public static boolean equals(short[] a, short[] b) Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(short[] a, int fromIndexA, short[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two short arrays for equality within the specified range.- Parameters:
a- the first short array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second short array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equals
public static boolean equals(int[] a, int[] b) Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(int[] a, int fromIndexA, int[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two int arrays for equality within the specified range.- Parameters:
a- the first int array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second int array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equals
public static boolean equals(long[] a, long[] b) Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(long[] a, int fromIndexA, long[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two long arrays for equality within the specified range.- Parameters:
a- the first long array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second long array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equals
public static boolean equals(float[] a, float[] b) Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(float[] a, int fromIndexA, float[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two float arrays for equality within the specified range.- Parameters:
a- the first float array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second float array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equals
public static boolean equals(double[] a, double[] b) Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(double[] a, int fromIndexA, double[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two double arrays for equality within the specified range.- Parameters:
a- the first double array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second double array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equals
Compares two arrays for equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
equals
public static boolean equals(Object[] a, int fromIndexA, Object[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays for equality within the specified range.- Parameters:
a- the first array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
deepEquals
Compares two objects for equality. If the objects are arrays, the appropriateArrays.deepEqualsmethod will be used.- Parameters:
a- the first object to compare, may be nullb- the second object to compare, may be null- Returns:
trueif the objects are deeply equal,falseotherwise- See Also:
-
deepEquals
Compares two arrays for deep equality.- Parameters:
a- the first arrayb- the second array- Returns:
trueif the arrays are equal,falseotherwise- See Also:
-
deepEquals
public static boolean deepEquals(Object[] a, int fromIndexA, Object[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays for deep equality within the specified range.- Parameters:
a- the first array, must not be nullfromIndexA- the starting index in the first array, inclusiveb- the second array, must not be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal,falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
equalsIgnoreCase
Compares two arrays of Strings, ignoring case considerations.- Parameters:
a- the first array of Strings to compare, may be nullb- the second array of Strings to compare, may be null- Returns:
trueif the arrays are equal, ignoring case considerations, or both are null;falseotherwise
-
equalsIgnoreCase
public static boolean equalsIgnoreCase(String[] a, int fromIndexA, String[] b, int fromIndexB, int len) throws IllegalArgumentException, IndexOutOfBoundsException Compares two arrays of Strings, ignoring case considerations, within the specified range.- Parameters:
a- the first array of Strings to compare, may be nullfromIndexA- the starting index in the first array, inclusiveb- the second array of Strings to compare, may be nullfromIndexB- the starting index in the second array, inclusivelen- the number of elements to compare- Returns:
trueif the specified range of elements in both arrays are equal, ignoring case considerations, or both are null;falseotherwise- Throws:
IllegalArgumentException- if the length is negativeIndexOutOfBoundsException- if the specified range is out of bounds
-
equalsByProps
public static boolean equalsByProps(Object bean1, Object bean2, Collection<String> propNamesToCompare) throws IllegalArgumentException Compares the specified properties of two beans to determine if they are equal.- Parameters:
bean1- the first bean to compare, must not be nullbean2- the second bean to compare, must not be nullpropNamesToCompare- the collection of property names to compare, must not be null- Returns:
trueif the properties of the beans are equal,falseotherwise- Throws:
IllegalArgumentException- if any of the arguments are null
-
equalsByCommonProps
public static boolean equalsByCommonProps(@NotNull Object bean1, @NotNull Object bean2) throws IllegalArgumentException Compares the properties of two beans to determine if they are equal.- Parameters:
bean1- the first bean to compare, must not be nullbean2- the second bean to compare, must not be nullpropNamesToCompare- the array of property names to compare, must not be null- Returns:
trueif all the properties of the beans are equal,falseotherwise- Throws:
IllegalArgumentException- if any of the arguments are null
-
hashCode
public static int hashCode(boolean value) Returns the hash code for a boolean value.- Parameters:
value- the boolean value- Returns:
- the hash code.
-
hashCode
public static int hashCode(char value) Returns the hash code for a char value.- Parameters:
value- the char value- Returns:
- the hash code
-
hashCode
public static int hashCode(byte value) Returns the hash code for a byte value.- Parameters:
value- the byte value- Returns:
- the hash code
-
hashCode
public static int hashCode(short value) Returns the hash code for a short value.- Parameters:
value- the short value- Returns:
- the hash code
-
hashCode
public static int hashCode(int value) Returns the hash code for an int value.- Parameters:
value- the int value- Returns:
- the hash code
-
hashCode
public static int hashCode(long value) Returns the hash code for a long value.- Parameters:
value- the long value- Returns:
- the hash code
-
hashCode
public static int hashCode(float value) Returns the hash code for a float value.- Parameters:
value- the float value- Returns:
- the hash code
-
hashCode
public static int hashCode(double value) Returns the hash code for a double value.- Parameters:
value- the double value- Returns:
- the hash code
-
hashCode
Returns the hash code for an object. If the object is an array, the appropriateArrays.hashCodemethod will be used- Parameters:
obj- the object for which the hash code is to be calculated- Returns:
- the hash code of the object, or 0 if the object is null
-
hashCode
public static int hashCode(boolean[] a) Returns the hash code for an array of booleans.- Parameters:
a- the array of booleans- Returns:
- the hash code of the array
- See Also:
-
hashCode
public static int hashCode(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns the hash code for a range of elements in a boolean array.- Parameters:
a- the array of booleansfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
hashCode
public static int hashCode(char[] a) Returns the hash code for an array of chars.- Parameters:
a- the array of chars- Returns:
- the hash code of the array
- See Also:
-
hashCode
Returns the hash code for a range of elements in a char array.- Parameters:
a- the array of charsfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
hashCode
public static int hashCode(byte[] a) Returns the hash code for an array of bytes.- Parameters:
a- the array of bytes- Returns:
- the hash code of the array
- See Also:
-
hashCode
Returns the hash code for a range of elements in a byte array.- Parameters:
a- the array of bytesfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
hashCode
public static int hashCode(short[] a) Returns the hash code for an array of shorts.- Parameters:
a- the array of shorts- Returns:
- the hash code of the array
- See Also:
-
hashCode
Returns the hash code for a range of elements in a short array.- Parameters:
a- the array of shortsfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
hashCode
public static int hashCode(int[] a) Returns the hash code for an array of ints.- Parameters:
a- the array of ints- Returns:
- the hash code of the array
- See Also:
-
hashCode
Returns the hash code for a range of elements in an int array.- Parameters:
a- the array of intsfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
hashCode
public static int hashCode(long[] a) Returns the hash code for an array of longs.- Parameters:
a- the array of longs- Returns:
- the hash code of the array
- See Also:
-
hashCode
Returns the hash code for a range of elements in a long array.- Parameters:
a- the array of longsfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
hashCode
public static int hashCode(float[] a) Returns the hash code for an array of floats.- Parameters:
a- the array of floats- Returns:
- the hash code of the array
- See Also:
-
hashCode
Returns the hash code for a range of elements in a float array.- Parameters:
a- the array of floatsfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
hashCode
public static int hashCode(double[] a) Returns the hash code for an array of doubles.- Parameters:
a- the array of doubles- Returns:
- the hash code of the array
- See Also:
-
hashCode
Returns the hash code for a range of elements in a double array.- Parameters:
a- the array of doublesfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
hashCode
Returns the hash code for an array of Objects.- Parameters:
a- the array of Objects- Returns:
- the hash code of the array
- See Also:
-
hashCode
Returns the hash code for a range of elements in an Object array.- Parameters:
a- the array of ObjectsfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
deepHashCode
Returns the hash code for the specified object. If the object is an array, the appropriateArrays.deepHashCodemethod will be used.- Parameters:
obj- the object for which the hash code is to be calculated- Returns:
- the hash code of the object, or 0 if the object is null
- See Also:
-
deepHashCode
Returns the hash code for an array of Objects.- Parameters:
a- the array of Objects- Returns:
- the hash code of the array
- See Also:
-
deepHashCode
public static int deepHashCode(Object[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns the hash code for a range of elements in an Object array.- Parameters:
a- the array of ObjectsfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the hash code for the specified range of the array
- Throws:
IndexOutOfBoundsException- if the indices are out of range- See Also:
-
toString
Returns a string representation of the specified boolean value.- Parameters:
value- the boolean value to be represented as a string- Returns:
- the String representation of the boolean value
-
toString
Returns a string representation of the specified char value.- Parameters:
value- the char value to be represented as a string- Returns:
- the String representation of the char value
-
toString
Returns a string representation of the specified byte value.- Parameters:
value- the byte value to be represented as a string- Returns:
- the String representation of the byte value
-
toString
Returns a string representation of the specified short value.- Parameters:
value- the short value to be represented as a string- Returns:
- the String representation of the short value
-
toString
Returns a string representation of the specified int value.- Parameters:
value- the int value to be represented as a string- Returns:
- the String representation of the int value
-
toString
Returns a string representation of the specified long value.- Parameters:
value- the long value to be represented as a string- Returns:
- the String representation of the long value
-
toString
Returns a string representation of the specified float value.- Parameters:
value- the float value to be represented as a string- Returns:
- the String representation of the float value
-
toString
Returns a string representation of the specified double value.- Parameters:
value- the double value to be represented as a string- Returns:
- the String representation of the double value
-
toString
Returns a string representation of the specified object.- Parameters:
obj- the object to be represented as a string- Returns:
- the String representation of the object. If the object is
null, the string"null"is returned.
-
toString
Returns a string representation of the specified object. If the object isnull, the specified default value is returned.- Parameters:
defaultIfNull- the default value to be returned if the object is nullobj- the object to be represented as a string- Returns:
- the String representation of the object, or the default value if the object is null
-
toString
Returns a string representation of the specified boolean array.- Parameters:
a- the boolean array to be represented as a string- Returns:
- the String representation of the boolean array
- See Also:
-
toString
public static String toString(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the specified range of elements in a boolean array.- Parameters:
a- the boolean array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the boolean array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
toString
Returns a string representation of the specified char array.- Parameters:
a- the char array to be represented as a string- Returns:
- the String representation of the char array
- See Also:
-
toString
public static String toString(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the specified range of elements in a char array.- Parameters:
a- the char array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the char array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
toString
Returns a string representation of the specified byte array.- Parameters:
a- the byte array to be represented as a string- Returns:
- the String representation of the byte array
- See Also:
-
toString
public static String toString(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the specified range of elements in a byte array.- Parameters:
a- the byte array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the byte array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
toString
Returns a string representation of the specified short array.- Parameters:
a- the short array to be represented as a string- Returns:
- the String representation of the short array
- See Also:
-
toString
public static String toString(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the specified range of elements in a short array.- Parameters:
a- the short array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the short array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
toString
Returns a string representation of the specified int array.- Parameters:
a- the int array to be represented as a string- Returns:
- the String representation of the int array
- See Also:
-
toString
Returns a string representation of the specified range of elements in an int array.- Parameters:
a- the int array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the int array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
toString
Returns a string representation of the specified long array.- Parameters:
a- the long array to be represented as a string- Returns:
- the String representation of the long array
- See Also:
-
toString
public static String toString(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the specified range of elements in a long array.- Parameters:
a- the long array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the long array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
toString
Returns a string representation of the specified float array.- Parameters:
a- the float array to be represented as a string- Returns:
- the String representation of the float array
- See Also:
-
toString
public static String toString(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the specified range of elements in a float array.- Parameters:
a- the float array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the float array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
toString
Returns a string representation of the specified double array.- Parameters:
a- the double array to be represented as a string- Returns:
- the String representation of the double array
- See Also:
-
toString
public static String toString(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the specified range of elements in a double array.- Parameters:
a- the double array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the double array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
toString
Returns a string representation of the specified Object array.- Parameters:
a- the Object array to be represented as a string- Returns:
- the String representation of the Object array
- See Also:
-
toString
public static String toString(Object[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the specified range of elements in an Object array.- Parameters:
a- the Object array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the Object array
- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
deepToString
Returns a string representation of the "deep contents" of the specified object. If the object is an array, the appropriateArrays.toString(array)method will be used. This method recursively converts the object and its nested objects to a string.- Parameters:
obj- the object to be represented as a string- Returns:
- the string representation of the object
-
deepToString
Returns a string representation of the "deep contents" of the specified array. If the object isnull, the specified default value is returned.- Parameters:
obj- the object to be represented as a stringdefaultIfNull- the default value to be returned if the object is null- Returns:
- the String representation of the object, or the default value if the object is null
- See Also:
-
deepToString
public static String deepToString(Object[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a string representation of the "deep contents" of the specified range of elements in an Object array. This method recursively converts the object and its nested objects to a string.- Parameters:
a- the Object array to be represented as a stringfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Returns:
- the String representation of the specified range of the Object array
- Throws:
IndexOutOfBoundsException- if the indices are out of range- See Also:
-
deepToString
Returns a string representation of the "deep contents" of the specified array. If the object isnull, the specified default value is returned.- Parameters:
a- the Object array to be represented as a stringdefaultIfNull- the default value to be returned if the object is null- Returns:
- the String representation of the object, or the default value if the object is null
- See Also:
-
reverse
public static void reverse(boolean[] a) Reverses the order of the elements in the specified boolean array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the boolean array to be reversed
-
reverse
public static void reverse(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Reverses the order of the elements in the specified range of the specified boolean array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the boolean array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
public static void reverse(char[] a) Reverses the order of the elements in the specified char array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the char array to be reversed
-
reverse
Reverses the order of the elements in the specified range of the specified char array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the char array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
public static void reverse(byte[] a) Reverses the order of the elements in the specified byte array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the byte array to be reversed
-
reverse
Reverses the order of the elements in the specified range of the specified byte array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the byte array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
public static void reverse(short[] a) Reverses the order of the elements in the specified short array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the short array to be reversed
-
reverse
Reverses the order of the elements in the specified range of the specified short array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the short array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
public static void reverse(int[] a) Reverses the order of the elements in the specified int array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the int array to be reversed
-
reverse
Reverses the order of the elements in the specified range of the specified int array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the int array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
public static void reverse(long[] a) Reverses the order of the elements in the specified long array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the long array to be reversed
-
reverse
Reverses the order of the elements in the specified range of the specified long array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the long array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
public static void reverse(float[] a) Reverses the order of the elements in the specified float array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the float array to be reversed
-
reverse
Reverses the order of the elements in the specified range of the specified float array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the float array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
public static void reverse(double[] a) Reverses the order of the elements in the specified double array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the double array to be reversed
-
reverse
Reverses the order of the elements in the specified range of the specified double array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the double array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
Reverses the order of the elements in the specified object array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the object array to be reversed
-
reverse
Reverses the order of the elements in the specified range of the specified object array. The reversing is performed in-place, meaning the original array is modified.- Parameters:
a- the object array to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range
-
reverse
Reverses the order of the elements in the specified list. The reversing is performed in-place, meaning the original list is modified.- Parameters:
list- the list to be reversed- See Also:
-
reverse
public static void reverse(List<?> list, int fromIndex, int toIndex) throws IndexOutOfBoundsException Reverses the order of the elements in the specified range of the specified list. The reversing is performed in-place, meaning the original list is modified.- Parameters:
list- the list to be reversedfromIndex- the starting index (inclusive)toIndex- the ending index (exclusive)- Throws:
IndexOutOfBoundsException- if the indices are out of range- See Also:
-
reverse
Reverses the order of the elements in the specified collection that has a well-defined encounter order. The reversing is performed in-place, meaning the original collection is modified.- Parameters:
c- the collection to be reversed. It should be a collection that has a well-defined encounter order.- See Also:
-
reverseToList
Returns a new list with the elements from the specified collection in reverse order. The specified collection doesn't need to have a well-defined encounter order and won't be modified.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection whose elements will be added to the returned list in reverse order.- Returns:
- a new list with the elements from the specified collection in reverse order.
- See Also:
-
rotate
public static void rotate(boolean[] a, int distance) Rotates the elements of the specified boolean array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the boolean array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
public static void rotate(char[] a, int distance) Rotates the elements of the specified char array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the char array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
public static void rotate(byte[] a, int distance) Rotates the elements of the specified byte array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the byte array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
public static void rotate(short[] a, int distance) Rotates the elements of the specified short array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the short array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
public static void rotate(int[] a, int distance) Rotates the elements of the specified int array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the int array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
public static void rotate(long[] a, int distance) Rotates the elements of the specified long array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the long array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
public static void rotate(float[] a, int distance) Rotates the elements of the specified float array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the float array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
public static void rotate(double[] a, int distance) Rotates the elements of the specified double array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the double array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
Rotates the elements of the specified Object array by the specified distance. The rotation is performed in-place, meaning the original array is modified.- Parameters:
a- the Object array to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.
-
rotate
Rotates the elements of the specified list by the specified distance. The rotation is performed in-place, meaning the original list is modified.- Parameters:
list- the list to be rotateddistance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.- See Also:
-
rotate
Rotates the elements of the specified collection that has a well-defined encounter order by the specified distance. The rotation is performed in-place, meaning the original collection is modified.- Parameters:
c- the collection to be rotated. It should be a collection that has a well-defined encounter order.distance- the distance to rotate the array. Positive values rotate the array to the right, and negative values rotate the array to the left.- See Also:
-
shuffle
public static void shuffle(boolean[] a) Shuffles the elements of the specified boolean array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the boolean array to be shuffled
-
shuffle
Shuffles the elements of the specified boolean array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the boolean array to be shuffledrnd- the random number generator to use
-
shuffle
public static void shuffle(char[] a) Shuffles the elements of the specified char array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the char array to be shuffled
-
shuffle
Shuffles the elements of the specified char array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the char array to be shuffledrnd- the random number generator to use
-
shuffle
public static void shuffle(byte[] a) Shuffles the elements of the specified byte array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the byte array to be shuffled
-
shuffle
Shuffles the elements of the specified byte array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the byte array to be shuffledrnd- the random number generator to use
-
shuffle
public static void shuffle(short[] a) Shuffles the elements of the specified short array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the short array to be shuffled
-
shuffle
Shuffles the elements of the specified short array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the short array to be shuffledrnd- the random number generator
-
shuffle
public static void shuffle(int[] a) Shuffles the elements of the specified int array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the int array to be shuffled
-
shuffle
Shuffles the elements of the specified int array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the int array to be shuffledrnd- the random number generator to use
-
shuffle
public static void shuffle(long[] a) Shuffles the elements of the specified long array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the long array to be shuffled
-
shuffle
Shuffles the elements of the specified long array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the long array to be shuffledrnd- the random number generator to use
-
shuffle
public static void shuffle(float[] a) Shuffles the elements of the specified float array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the float array to be shuffled
-
shuffle
Shuffles the elements of the specified float array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the float array to be shuffledrnd- the random number generator to use
-
shuffle
public static void shuffle(double[] a) Shuffles the elements of the specified double array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the double array to be shuffled
-
shuffle
Shuffles the elements of the specified double array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the double array to be shuffledrnd- the random number generator to use
-
shuffle
Shuffles the elements of the specified object array. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the object array to be shuffled
-
shuffle
Shuffles the elements of the specified object array using the specified random number generator. The shuffling is performed in-place, meaning the original array is modified.- Parameters:
a- the object array to be shuffledrnd- the random number generator to use
-
shuffle
Shuffles the elements of the specified list. The shuffling is performed in-place, meaning the original list is modified.- Parameters:
list- the list to be shuffled- See Also:
-
shuffle
Shuffles the elements of the specified list using the specified random number generator. The shuffling is performed in-place, meaning the original list is modified.- Parameters:
list- the list to be shuffledrnd- the random number generator to use- See Also:
-
shuffle
Shuffles the elements of the specified collection that has a well-defined encounter order. The shuffling is performed in-place, meaning the original collection is modified.- Parameters:
c- the collection to be shuffled. It should be a collection that has a well-defined encounter order.- See Also:
-
shuffle
Shuffles the elements of the specified collection that has a well-defined encounter order using the specified random number generator. The shuffling is performed in-place, meaning the original collection is modified.- Parameters:
c- the collection to be shuffled. It should be a collection that has a well-defined encounter order.rnd- the random number generator to use- See Also:
-
swap
public static void swap(boolean[] a, int i, int j) Swaps the elements at the specified positions in the specified boolean array.- Parameters:
a- the boolean array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
public static void swap(char[] a, int i, int j) Swaps the elements at the specified positions in the specified char array.- Parameters:
a- the char array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
public static void swap(byte[] a, int i, int j) Swaps the elements at the specified positions in the specified byte array.- Parameters:
a- the byte array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
public static void swap(short[] a, int i, int j) Swaps the elements at the specified positions in the specified short array.- Parameters:
a- the short array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
public static void swap(int[] a, int i, int j) Swaps the elements at the specified positions in the specified int array.- Parameters:
a- the int array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
public static void swap(long[] a, int i, int j) Swaps the elements at the specified positions in the specified long array.- Parameters:
a- the long array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
public static void swap(float[] a, int i, int j) Swaps the elements at the specified positions in the specified float array.- Parameters:
a- the float array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
public static void swap(double[] a, int i, int j) Swaps the elements at the specified positions in the specified double array.- Parameters:
a- the double array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
Swaps the elements at the specified positions in the specified Object array.- Parameters:
a- the Object array in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped
-
swap
Swaps the elements at the specified positions in the specified list.- Parameters:
list- the list in which to swap elementsi- the index of one element to be swappedj- the index of the other element to be swapped- See Also:
-
swap
Swaps the left and right elements in the specified pair.- Type Parameters:
T- the type of the elements in the pair- Parameters:
pair- the pair whose elements are to be swapped
-
swapIf
Swaps the left and right elements in the specified pair if the specified predicate istrue.- Type Parameters:
T- the type of the elements in the pair- Parameters:
pair- the pair whose elements are to be swappedpredicate- the predicate to determine if the elements should be swapped- Returns:
trueif the left and right elements are swapped, otherwisefalse
-
swap
Swaps the left and right elements in the specified triple.- Type Parameters:
T- the type of the elements in the triple- Parameters:
triple- the triple whose elements are to be swapped
-
swapIf
public static <T,M> boolean swapIf(Triple<T, M, T> triple, Predicate<? super Triple<T, M, T>> predicate) Swaps the left and right elements in the specified triple if the specified predicate istrue.- Type Parameters:
T- the type of the elements in the triple- Parameters:
triple- the triple whose elements are to be swappedpredicate- the predicate to determine if the elements should be swapped- Returns:
trueif the left and right elements are swapped, otherwisefalse
-
fill
public static void fill(boolean[] a, boolean val) Fills the specified boolean array with the specified value.- Parameters:
a- the boolean array to be filledval- the boolean value to fill the array with- See Also:
-
fill
public static void fill(boolean[] a, int fromIndex, int toIndex, boolean val) Fills the specified boolean array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the boolean array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the boolean value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
public static void fill(char[] a, char val) Fills the specified char array with the specified value.- Parameters:
a- the char array to be filledval- the char value to fill the array with- See Also:
-
fill
public static void fill(char[] a, int fromIndex, int toIndex, char val) Fills the specified char array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the char array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the char value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
public static void fill(byte[] a, byte val) Fills the specified byte array with the specified value.- Parameters:
a- the byte array to be filledval- the byte value to fill the array with- See Also:
-
fill
public static void fill(byte[] a, int fromIndex, int toIndex, byte val) Fills the specified byte array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the byte array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the byte value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
public static void fill(short[] a, short val) Fills the specified short array with the specified value.- Parameters:
a- the short array to be filledval- the short value to fill the array with- See Also:
-
fill
public static void fill(short[] a, int fromIndex, int toIndex, short val) Fills the specified short array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the short array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the short value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
public static void fill(int[] a, int val) Fills the specified int array with the specified value.- Parameters:
a- the int array to be filledval- the int value to fill the array with- See Also:
-
fill
public static void fill(int[] a, int fromIndex, int toIndex, int val) Fills the specified int array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the int array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the int value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
public static void fill(long[] a, long val) Fills the specified long array with the specified value.- Parameters:
a- the long array to be filledval- the long value to fill the array with- See Also:
-
fill
public static void fill(long[] a, int fromIndex, int toIndex, long val) Fills the specified long array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the long array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the long value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
public static void fill(float[] a, float val) Fills the specified float array with the specified value.- Parameters:
a- the float array to be filledval- the float value to fill the array with- See Also:
-
fill
public static void fill(float[] a, int fromIndex, int toIndex, float val) Fills the specified float array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the float array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the float value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
public static void fill(double[] a, double val) Fills the specified double array with the specified value.- Parameters:
a- the double array to be filledval- the double value to fill the array with- See Also:
-
fill
public static void fill(double[] a, int fromIndex, int toIndex, double val) Fills the specified double array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the double array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the double value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
Fills the specified Object array with the specified value.- Parameters:
a- the Object array to be filledval- the Object value to fill the array with- See Also:
-
fill
Fills the specified Object array with the specified value from the specified fromIndex (inclusive) to the specified toIndex (exclusive).- Parameters:
a- the Object array to be filledfromIndex- the index to start filling (inclusive)toIndex- the index to stop filling (exclusive)val- the Object value to fill the array with- Throws:
IllegalArgumentException- iffromIndex > toIndexArrayIndexOutOfBoundsException- iffromIndex < 0ortoIndex > a.length- See Also:
-
fill
Fills the specified list with the specified value.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be filledval- the value to fill the list with- Throws:
IllegalArgumentException- if the specified list is null- See Also:
-
fill
public static <T> void fill(List<? super T> list, int fromIndex, int toIndex, T val) throws IndexOutOfBoundsException Fills the specified list with the specified value from the specified start index to the specified end index. The list will be extended automatically if the size of the list is less than the specified toIndex.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be filledfromIndex- the starting index (inclusive) to begin fillingtoIndex- the ending index (exclusive) to stop fillingval- the value to fill the list with- Throws:
IllegalArgumentException- if the specified list is nullIndexOutOfBoundsException- if the specified indices are out of range- See Also:
-
fill
Fills the properties of the specified bean with random values.- Parameters:
bean- the bean object with getter/setter methods to be filled with random values- Throws:
IllegalArgumentException- if the specified bean isnullor the bean class is not a valid JavaBean
-
fill
Fills the properties of a new instance of the specified bean class with random values.- Type Parameters:
T- the type of the bean- Parameters:
beanClass- the class of the bean to be filled- Returns:
- a new instance of the specified bean class with properties filled with random values
- Throws:
IllegalArgumentException- if the specified beanClass isnullor the bean class is not a valid JavaBean
-
fill
public static <T> List<T> fill(Class<? extends T> beanClass, int count) throws IllegalArgumentException Returns a list of new instances of the specified bean class with properties filled with random values.- Type Parameters:
T- the type of the bean- Parameters:
beanClass- the class of the bean to be filledcount- the number of instances to create and fill- Returns:
- a list of new instances of the specified bean class with properties filled with random values
- Throws:
IllegalArgumentException- if the specified beanClass isnullor the bean class is not a valid JavaBean
-
padLeft
public static <T> boolean padLeft(List<T> list, int minSize, T objToAdd) throws IllegalArgumentException Appends the provided object to the beginning of the list till the list has at least the specified minimum size.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be paddedminSize- the minimum size the list should have after this operationobjToAdd- the object to add to the list if it is smaller than the specified minimum size- Returns:
trueif the list was modified as a result of this operation,falseotherwise- Throws:
IllegalArgumentException- if the list isnullor the minimum size is negative
-
padRight
public static <T> boolean padRight(Collection<T> c, int minSize, T objToAdd) throws IllegalArgumentException Appends the provided object to the end of the collection until the collection has at least the specified minimum size.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to be paddedminSize- the minimum size the collection should have after paddingobjToAdd- the object to be added to the collection- Returns:
trueif the collection was modified,falseotherwise- Throws:
IllegalArgumentException- if the collection isnullor the minimum size is negative- See Also:
-
repeat
Repeats the provided value a specified number of times.- Type Parameters:
T- the type of the value to be repeated- Parameters:
value- the value to be repeatedn- the number of times to repeat the value- Returns:
- a list containing the repeated values
- Throws:
IllegalArgumentException- if the specified number of repetitions is negative- See Also:
-
repeatElements
public static <T> List<T> repeatElements(Collection<? extends T> c, int n) throws IllegalArgumentException Repeats each element in the specified Collection n times one by one.repeatElements(N.asList(1, 2, 3), 2) => [1, 1, 2, 2, 3, 3]- Type Parameters:
T- the type of the elements in the collection- Parameters:
c- the collection whose elements are to be repeatedn- the number of times to repeat the elements- Returns:
- a list containing the repeated elements
- Throws:
IllegalArgumentException- if the specified collection isnullor empty, or specified number of repetitions is negative- See Also:
-
repeatCollection
Repeats the entire specified Collectionntimes.repeatCollection(N.asList(1, 2, 3), 2) => [1, 2, 3, 1, 2, 3]- Type Parameters:
T- the type of the elements in the collection- Parameters:
c- the collection whose elements are to be repeatedn- the number of times to repeat the elements- Returns:
- a list containing the repeated elements
- Throws:
IllegalArgumentException- if the specified collection isnullor empty, or specified number of repetitions is negative- See Also:
-
repeatElementsToSize
public static <T> List<T> repeatElementsToSize(Collection<T> c, int size) throws IllegalArgumentException Repeats each element in the specified Collection n times one by one till reach the specified size.repeatElementsToSize(N.asList(1, 2, 3), 5) => [1, 1, 2, 2, 3]- Type Parameters:
T- the type of the elements in the collection- Parameters:
c- the collection whose elements are to be repeatedsize- the target size of the resulting list- Returns:
- a list containing the repeated elements
- Throws:
IllegalArgumentException- if the specified collection isnullor empty, or the specified size is negativeIllegalArgumentException- See Also:
-
repeatCollectionToSize
public static <T> List<T> repeatCollectionToSize(Collection<? extends T> c, int size) throws IllegalArgumentException Repeats the entire specified Collectionntimes till reach the specified size.repeatCollectionToSize(N.asList(1, 2, 3), 5) => [1, 2, 3, 1, 2]- Type Parameters:
T- the type of the elements in the collection- Parameters:
c- the collection whose elements are to be repeatedsize- the target size of the resulting list- Returns:
- a list containing the repeated elements
- Throws:
IllegalArgumentException- if the specified collection isnullor empty, or the specified size is negative- See Also:
-
copy
Copies all of the elements from the source list into the destination list. After the operation, the index of each copied element in the destination list will be identical to its index in the source list. The destination list must be at least as long as the source list. If it is longer, the remaining elements in the destination list are unaffected. This method runs in linear time.- Type Parameters:
T- the type of elements in the lists- Parameters:
src- the source list from which elements are to be copieddest- the destination list to which elements are to be copied- Throws:
IndexOutOfBoundsException- if the destination list is too small to contain the entire source listUnsupportedOperationException- if the destination list's list-iterator does not support the set operation- See Also:
-
copy
public static <T> void copy(List<? extends T> src, int srcPos, List<? super T> dest, int destPos, int length) throws IndexOutOfBoundsException Copies a portion of one list into another. The portion to be copied begins at the index srcPos in the source list and spans length elements. The elements are copied into the destination list starting at position destPos. Both source and destination positions are zero-based.- Type Parameters:
T- the type of elements in the lists- Parameters:
src- the source list from which to copy elementssrcPos- the starting position in the source listdest- the destination list into which to copy elementsdestPos- the starting position in the destination listlength- the number of elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside list bounds
-
copy
public static void copy(boolean[] src, int srcPos, boolean[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source boolean array to the destination boolean array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(char[] src, int srcPos, char[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source char array to the destination char array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(byte[] src, int srcPos, byte[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source byte array to the destination byte array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(short[] src, int srcPos, short[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source short array to the destination short array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(int[] src, int srcPos, int[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source int array to the destination int array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(long[] src, int srcPos, long[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source long array to the destination long array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(float[] src, int srcPos, float[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source float array to the destination float array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(double[] src, int srcPos, double[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source double array to the destination double array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(Object[] src, int srcPos, Object[] dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source array to the destination array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copy
public static void copy(Object src, int srcPos, Object dest, int destPos, int length) throws IndexOutOfBoundsException Copies elements from the source array to the destination array.- Parameters:
src- the source array from which elements are to be copiedsrcPos- starting position in the source arraydest- the destination array to which elements are to be copieddestPos- starting position in the destination arraylength- the number of array elements to be copied- Throws:
IndexOutOfBoundsException- if copying would cause access of data outside array bounds- See Also:
-
copyOf
public static boolean[] copyOf(boolean[] original, int newLength) Returns a new boolean array containing a copy of the original array, truncated or padded withfalse(if necessary) so the copy has the specified length.- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new boolean array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOf
public static char[] copyOf(char[] original, int newLength) Returns a new char array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new char array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOf
public static byte[] copyOf(byte[] original, int newLength) Returns a new byte array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new byte array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOf
public static short[] copyOf(short[] original, int newLength) Returns a new short array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new short array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOf
public static int[] copyOf(int[] original, int newLength) Returns a new int array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new int array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOf
public static long[] copyOf(long[] original, int newLength) Returns a new long array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new long array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOf
public static float[] copyOf(float[] original, int newLength) Returns a new float array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new float array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOf
public static double[] copyOf(double[] original, int newLength) Returns a new double array containing a copy of the original array, truncated or padded with default value (if necessary) so the copy has the specified length.- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new double array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOf
public static <T> T[] copyOf(T[] original, int newLength) Returns a new Object array containing a copy of the original array, truncated or padded withnull(if necessary) so the copy has the specified length.- Type Parameters:
T- the type of the elements in the array- Parameters:
original- the array to be copiednewLength- the length of the copy to be returned- Returns:
- a new Object array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negativeNullPointerException- iforiginalis null- See Also:
-
copyOf
Returns a new array containing a copy of the original array, truncated or padded withnull(if necessary) so the copy has the specified length.- Type Parameters:
T- the type of the elements in the arrayU- the type of the elements in the original array- Parameters:
original- the array to be copiednewLength- the length of the copy to be returnednewType- the class of the copy to be returned- Returns:
- a new array containing a copy of the original array
- Throws:
IllegalArgumentException- if the specified new length is negative- See Also:
-
copyOfRange
public static boolean[] copyOfRange(boolean[] original, int fromIndex, int toIndex) Returns a new boolean array containing a copy of the specified range of the original array.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new boolean array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static boolean[] copyOfRange(boolean[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new boolean array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new boolean array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static char[] copyOfRange(char[] original, int fromIndex, int toIndex) Returns a new char array containing a copy of the specified range of the original array.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new char array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static char[] copyOfRange(char[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new char array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new char array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static byte[] copyOfRange(byte[] original, int fromIndex, int toIndex) Returns a new byte array containing a copy of the specified range of the original array.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new byte array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static byte[] copyOfRange(byte[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new byte array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new byte array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static short[] copyOfRange(short[] original, int fromIndex, int toIndex) Returns a new short array containing a copy of the specified range of the original array.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new short array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static short[] copyOfRange(short[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new short array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new short array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static int[] copyOfRange(int[] original, int fromIndex, int toIndex) Returns a new int array containing a copy of the specified range of the original array.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new int array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static int[] copyOfRange(int[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new int array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.int[] a = { 0, 1, 2, 3, 4, 5 }; N.copyOfRange(a, 1, 5, 1)); // [1, 2, 3, 4] N.copyOfRange(a, 1, 5, 2); // [1, 3] N.copyOfRange(a, 5, 1, -1); // [5, 4, 3, 2] N.copyOfRange(a, 5, 1, -2); // [5, 3] N.copyOfRange(a, 5, -1, -1); // [5, 4, 3, 2, 1, 0] N.copyOfRange(a, 6, -1, -1); // [5, 4, 3, 2, 1, 0]- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new int array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null
-
copyOfRange
public static long[] copyOfRange(long[] original, int fromIndex, int toIndex) Returns a new long array containing a copy of the specified range of the original array.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new long array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static long[] copyOfRange(long[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new long array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new long array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static float[] copyOfRange(float[] original, int fromIndex, int toIndex) Returns a new float array containing a copy of the specified range of the original array.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new float array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static float[] copyOfRange(float[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new float array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new float array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static double[] copyOfRange(double[] original, int fromIndex, int toIndex) Returns a new double array containing a copy of the specified range of the original array.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new double array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static double[] copyOfRange(double[] original, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new double array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new double array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static <T> T[] copyOfRange(T[] original, int fromIndex, int toIndex) Returns a new Object array containing a copy of the specified range of the original array.- Type Parameters:
T- the type of the elements in the array- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new Object array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static <T> T[] copyOfRange(T[] original, int fromIndex, int toIndex, int step) Returns a new Object array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Type Parameters:
T- the type of the elements in the array- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new Object array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static <T,U> T[] copyOfRange(U[] original, int fromIndex, int toIndex, Class<? extends T[]> newType) Returns a new array containing a copy of the specified range of the original array.- Type Parameters:
T- the type of the elements in the new arrayU- the type of the elements in the original array- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivenewType- the class of the new array- Returns:
- a new array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayNullPointerException- if original is null- See Also:
-
copyOfRange
public static <T> T[] copyOfRange(T[] original, int fromIndex, int toIndex, int step, Class<? extends T[]> newType) throws IndexOutOfBoundsException Returns a new array containing a copy of the specified range of the original array, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Type Parameters:
T- the type of the elements in the new arrayU- the type of the elements in the original array- Parameters:
original- the array from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copiednewType- the class of the new array- Returns:
- a new array containing the specified range from the original array
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, or toIndex is larger than the length of arrayIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
public static <T> List<T> copyOfRange(List<T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Returns a new list containing a copy of the specified range of the original list.- Type Parameters:
T- the type of elements in the list- Parameters:
c- the list from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusive- Returns:
- a new list containing the specified range from the original list
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is greater than the size of listNullPointerException- if original is null
-
copyOfRange
public static <T> List<T> copyOfRange(List<T> c, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new list containing a copy of the specified range of the original list, with elements selected at intervals defined by the step parameter. If step negative, the elements will be copied in reverse order.- Type Parameters:
T- the type of elements in the list- Parameters:
c- the list from which a range is to be copiedfromIndex- the initial index of the range to be copied, inclusivetoIndex- the final index of the range to be copied, exclusivestep- the interval between elements to be copied- Returns:
- a new list containing the specified range from the original list
- Throws:
IndexOutOfBoundsException- if fromIndex is negative or larger than toIndex, toIndex is greater than the size of listIllegalArgumentException- if step is zeroNullPointerException- if original is null- See Also:
-
copyOfRange
Returns a new string that is a substring of the specified string. The substring begins at the specified fromIndex and extends to the character at index toIndex - 1. Thus, the length of the substring is toIndex - fromIndex.- Parameters:
str- the original string from which a range is to be copiedfromIndex- the beginning index, inclusivetoIndex- the ending index, exclusive- Returns:
- the specified substring
- Throws:
IndexOutOfBoundsException- if the fromIndex is negative, toIndex is greater than the length of the string, or fromIndex is greater than toIndex
-
copyOfRange
public static String copyOfRange(String str, int fromIndex, int toIndex, int step) throws IndexOutOfBoundsException Returns a new string that is a substring of the specified string, with characters selected at intervals defined by the step parameter. If step negative, the characters will be copied in reverse order.- Parameters:
str- the original string from which a range is to be copiedfromIndex- the beginning index, inclusivetoIndex- the ending index, exclusivestep- the interval between characters to be copied- Returns:
- the specified substring
- Throws:
IndexOutOfBoundsException- if the fromIndex is negative, toIndex is greater than the length of the string, or fromIndex is greater than toIndexIllegalArgumentException- if step is zero- See Also:
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Returns a new array that is a clone of the specified array, ornullif the original array isnull.- Parameters:
original- the array to be cloned- Returns:
- a clone of the original array, or
nullif the original array is null
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 2D array to be cloned- Returns:
- a clone of the original 2D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
clone
Clone the original array and its sub arrays.nullis returned if the input array isnull.- Parameters:
original- the 3D array to be cloned- Returns:
- a clone of the original 3D array, or
nullif the original array is null - See Also:
-
isSorted
public static boolean isSorted(boolean[] a) Checks if the specified boolean array is sorted in ascending order.- Parameters:
a- the boolean array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise
-
isSorted
public static boolean isSorted(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the boolean array is sorted in ascending order.- Parameters:
a- the boolean array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
isSorted
public static boolean isSorted(char[] a) Checks if the specified char array is sorted in ascending order.- Parameters:
a- the char array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise
-
isSorted
public static boolean isSorted(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the char array is sorted in ascending order.- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
isSorted
public static boolean isSorted(byte[] a) Checks if the specified byte array is sorted in ascending order.- Parameters:
a- the byte array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise
-
isSorted
public static boolean isSorted(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the byte array is sorted in ascending order.- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
isSorted
public static boolean isSorted(short[] a) Checks if the specified byte short is sorted in ascending order.- Parameters:
a- the short array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise
-
isSorted
public static boolean isSorted(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the short array is sorted in ascending order.- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
isSorted
public static boolean isSorted(int[] a) Checks if the specified integer array is sorted in ascending order.- Parameters:
a- the integer array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise
-
isSorted
public static boolean isSorted(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the integer array is sorted in ascending order.- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
isSorted
public static boolean isSorted(long[] a) Checks if the specified long array is sorted in ascending order.- Parameters:
a- the long array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise
-
isSorted
public static boolean isSorted(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the long array is sorted in ascending order.- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
isSorted
public static boolean isSorted(float[] a) Checks if the specified float array is sorted in ascending order.- Parameters:
a- the float array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise
-
isSorted
public static boolean isSorted(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the float array is sorted in ascending order.- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
isSorted
public static boolean isSorted(double[] a) Checks if the specified double array is sorted in ascending order.- Parameters:
a- the double array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise
-
isSorted
public static boolean isSorted(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the double array is sorted in ascending order.- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
isSorted
Checks if the specified array is sorted in ascending order (wherenullis smallest).- Type Parameters:
T- the type of elements in the array, which must be Comparable- Parameters:
a- the array to be checked- Returns:
trueif the array is sorted in ascending order,falseotherwise- See Also:
-
isSorted
public static <T extends Comparable<? super T>> boolean isSorted(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the array is sorted in ascending order (wherenullis smallest).- Type Parameters:
T- the type of elements in the array, which must be Comparable- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the array is sorted in ascending order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
isSorted
Checks if the array is sorted according to the order induced by the specified comparator.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be checkedcmp- the comparator to determine the order of the array- Returns:
trueif the array is sorted according to the specified comparator,falseotherwise- See Also:
-
isSorted
public static <T> boolean isSorted(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException Checks if the specified range of the array is sorted according to the order induced by the specified comparator.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checkedcmp- the comparator to determine the order of the array- Returns:
trueif the specified range of the array is sorted according to the specified comparator,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
isSorted
Checks if the collection is sorted in ascending order (wherenullis smallest).- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to be checked- Returns:
trueif the collection is sorted in natural order,falseotherwise- See Also:
-
isSorted
public static <T extends Comparable<? super T>> boolean isSorted(Collection<? extends T> c, int fromIndex, int toIndex) throws IndexOutOfBoundsException Checks if the specified range of the collection is sorted in ascending order (wherenullis smallest).- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checked- Returns:
trueif the specified range of the collection is sorted in natural order,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
isSorted
Checks if the collection is sorted according to the order induced by the specified comparator.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to be checkedcmp- the comparator to determine the order of the collection- Returns:
trueif the collection is sorted according to the specified comparator,falseotherwise- See Also:
-
isSorted
public static <T> boolean isSorted(Collection<? extends T> c, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException Checks if the specified range of the collection is sorted according to the order induced by the specified comparator.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to be checkedfromIndex- the starting index (inclusive) of the range to be checkedtoIndex- the ending index (exclusive) of the range to be checkedcmp- the comparator to determine the order of the collection- Returns:
trueif the specified range of the collection is sorted according to the specified comparator,falseotherwise- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
sort
public static void sort(boolean[] a) Sorts the specified array of booleans into ascending order.falseis considered less thantrue.- Parameters:
a- the array to be sorted
-
sort
Sorts the specified range of the array into ascending order.falseis considered less thantrue.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException
-
sort
public static void sort(char[] a) Sorts the specified array into ascending order.- Parameters:
a- the array to be sorted
-
sort
Sorts the specified range of the array into ascending order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException
-
sort
public static void sort(byte[] a) Sorts the specified array into ascending numerical order.- Parameters:
a- the array to be sorted
-
sort
Sorts the specified range of the array into ascending order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException
-
sort
public static void sort(short[] a) Sorts the specified array into ascending numerical order.- Parameters:
a- the array to be sorted
-
sort
Sorts the specified range of the array into ascending order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException
-
sort
public static void sort(int[] a) Sorts the specified array into ascending numerical order.- Parameters:
a- the array to be sorted
-
sort
Sorts the specified range of the array into ascending order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException
-
sort
public static void sort(long[] a) Sorts the specified array into ascending numerical order.- Parameters:
a- the array to be sorted
-
sort
Sorts the specified range of the array into ascending order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException
-
sort
public static void sort(float[] a) Sorts the specified array into ascending numerical order.- Parameters:
a- the array to be sorted
-
sort
Sorts the specified range of the array into ascending order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException
-
sort
public static void sort(double[] a) Sorts the specified array into ascending order.- Parameters:
a- the array to be sorted
-
sort
Sorts the specified range of the array into ascending order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException
-
sort
Sorts the specified array according to the natural ordering (wherenullis smallest).- Parameters:
a- the array to be sorted- Throws:
ClassCastException- if the array contains elements that are not mutually comparable- See Also:
-
sort
Sorts the specified range of the specified array according to the natural ordering (wherenullis smallest).- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range- See Also:
-
sort
Sorts the specified array according to the order induced by the specified comparator.- Type Parameters:
T- the type of the objects being compared- Parameters:
a- the array to be sortedcmp- the comparator to determine the order of the array. Anullvalue indicates that the elements' natural ordering should be used.- See Also:
-
sort
public static <T> void sort(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException Sorts the specified range of the specified array according to the order induced by the specified comparator.- Type Parameters:
T- the type of the objects being compared- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sortedcmp- the comparator to determine the order of the array. Anullvalue indicates that the elements' natural ordering should be used.- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
sort
Sorts the specified list according to the natural ordering (wherenullis smallest).- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sorted- See Also:
-
sort
public static <T extends Comparable<? super T>> void sort(List<? extends T> list, int fromIndex, int toIndex) Sorts the specified range of the specified list according to the natural ordering (wherenullis smallest).- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the specified range is out of- See Also:
-
sort
Sorts the specified list according to the order induced by the specified comparator.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedcmp- the comparator to determine the order of the list. Anullvalue indicates that the elements' natural ordering should be used- See Also:
-
sort
public static <T> void sort(List<? extends T> list, int fromIndex, int toIndex, Comparator<? super T> cmp) Sorts the specified range of the list according to the order induced by the specified comparator.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sortedcmp- the comparator to determine the order of the list. Anullvalue indicates that the elements' natural ordering should be used.- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
sortBy
public static <T,U extends Comparable<? super U>> void sortBy(T[] a, Function<? super T, ? extends U> keyExtractor) Sorts the specified array based on the keys extracted by the providedFunction.- Type Parameters:
T- the type of elements in the arrayU- the type of the key values, which must be comparable- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the key values from the array elements- See Also:
-
sortBy
public static <T,U extends Comparable<? super U>> void sortBy(List<? extends T> list, Function<? super T, ? extends U> keyExtractor) Sorts the specified list based on the keys extracted by the providedFunction.- Type Parameters:
T- the type of elements in the listU- the type of the key values, which must be comparable- Parameters:
keyExtractor- the function to extract the key values from the list elementsa- the array to be sorted- See Also:
-
sortByInt
Sorts the specified array into ascending numerical order based on the keys extracted by the providedToIntFunction.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the key values from the array elements
-
sortByInt
Sorts the specified list into ascending numerical order based on the keys extracted by the providedToIntFunction.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the key values from the list elements
-
sortByLong
Sorts the specified array into ascending numerical order based on the keys extracted by the providedToLongFunction.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the key values from the array elements
-
sortByLong
Sorts the specified list into ascending numerical order based on the keys extracted by the providedToLongFunction.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the key values from the list elements
-
sortByFloat
Sorts the specified array into ascending numerical order based on the keys extracted by the providedToFloatFunction.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the key values from the array elements
-
sortByFloat
Sorts the specified list into ascending numerical order based on the keys extracted by the providedToFloatFunction.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the key values from the list elements
-
sortByDouble
Sorts the specified array into ascending numerical order based on the keys extracted by the providedToDoubleFunction.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the key values from the array elements
-
sortByDouble
public static <T> void sortByDouble(List<? extends T> list, ToDoubleFunction<? super T> keyExtractor) Sorts the specified list into ascending numerical order based on the keys extracted by the providedToDoubleFunction.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the key values from the list elements
-
parallelSort
public static void parallelSort(char[] a) Sorts the specified array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sorted- See Also:
-
parallelSort
public static void parallelSort(char[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the fromIndex or toIndex is out of range- See Also:
-
parallelSort
public static void parallelSort(byte[] a) Sorts the specified array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sorted- See Also:
-
parallelSort
public static void parallelSort(byte[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the fromIndex or toIndex is out of range- See Also:
-
parallelSort
public static void parallelSort(short[] a) Sorts the specified array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sorted- See Also:
-
parallelSort
public static void parallelSort(short[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the fromIndex or toIndex is out of range- See Also:
-
parallelSort
public static void parallelSort(int[] a) Sorts the specified array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sorted- See Also:
-
parallelSort
public static void parallelSort(int[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the fromIndex or toIndex is out of range- See Also:
-
parallelSort
public static void parallelSort(long[] a) Sorts the specified array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sorted- See Also:
-
parallelSort
public static void parallelSort(long[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the fromIndex or toIndex is out of range- See Also:
-
parallelSort
public static void parallelSort(float[] a) Sorts the specified array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sorted- See Also:
-
parallelSort
public static void parallelSort(float[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the fromIndex or toIndex is out of range- See Also:
-
parallelSort
public static void parallelSort(double[] a) Sorts the specified array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sorted- See Also:
-
parallelSort
public static void parallelSort(double[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the array into ascending numerical order by multiple threads.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the fromIndex or toIndex is out of range- See Also:
-
parallelSort
Sorts the specified array according to the natural ordering (wherenullis minimum) by multiple threads.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to be sorted- See Also:
-
parallelSort
public static <T extends Comparable<? super T>> void parallelSort(T[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the specified array according to the natural ordering (wherenullis minimum) by multiple threads.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- if fromIndex > toIndexArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of rangeIndexOutOfBoundsException- See Also:
-
parallelSort
Sorts the specified array according to the order induced by the specified comparator by multiple threads.- Type Parameters:
T- the type of the objects being compared- Parameters:
a- the array to be sortedcmp- the comparator to determine the order of the array. Anullvalue indicates that the elements' natural ordering should be used.- See Also:
-
parallelSort
public static <T> void parallelSort(T[] a, int fromIndex, int toIndex, Comparator<? super T> cmp) throws IndexOutOfBoundsException Sorts the specified range of the specified array according to the order induced by the specified comparator by multiple threads.- Type Parameters:
T- the type of the objects being compared- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sortedcmp- the comparator to determine the order of the array. Anullvalue indicates that the elements' natural ordering should be used.- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
parallelSort
Sorts the specified list according to the natural ordering (wherenullis minimum) by multiple threads.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sorted- See Also:
-
parallelSort
public static <T extends Comparable<? super T>> void parallelSort(List<? extends T> list, int fromIndex, int toIndex) Sorts the specified range of the specified list according to the natural ordering (wherenullis minimum) by multiple threads.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the specified range is out of- See Also:
-
parallelSort
Sorts the specified list according to the order induced by the specified comparator by multiple threads.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedcmp- the comparator to determine the order of the list. Anullvalue indicates that the elements' natural ordering should be used- See Also:
-
parallelSort
public static <T> void parallelSort(List<? extends T> list, int fromIndex, int toIndex, Comparator<? super T> cmp) Sorts the specified range of the list according to the order induced by the specified comparator by multiple threads.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sortedcmp- the comparator to determine the order of the list. Anullvalue indicates that the elements' natural ordering should be used.- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds- See Also:
-
parallelSortBy
public static <T,U extends Comparable<? super U>> void parallelSortBy(T[] a, Function<? super T, ? extends U> keyExtractor) Sorts the specified array based on the keys extracted by the providedFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the arrayU- the type of the keys extracted by the key extractor function- Parameters:
a- the array to be sortedkeyExtractor- the function used to extract the keys for comparison- See Also:
-
parallelSortBy
public static <T,U extends Comparable<? super U>> void parallelSortBy(List<? extends T> list, Function<? super T, ? extends U> keyExtractor) Sorts the specified list based on the keys extracted by the providedFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the listU- the type of the keys extracted by the key extractor function- Parameters:
list- the list to be sortedkeyExtractor- the function used to extract the keys for comparison- See Also:
-
parallelSortByInt
Sorts the specified array based on the int values extracted by the providedToIntFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function used to extract the int key for comparison
-
parallelSortByInt
public static <T> void parallelSortByInt(List<? extends T> list, ToIntFunction<? super T> keyExtractor) Sorts the specified list based on the int values extracted by the providedToIntFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function used to extract the int key for comparison
-
parallelSortByLong
Sorts the specified array based on the long values extracted by the providedToLongFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function used to extract the long key for comparison
-
parallelSortByLong
public static <T> void parallelSortByLong(List<? extends T> list, ToLongFunction<? super T> keyExtractor) Sorts the specified list based on the long values extracted by the providedToLongFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function used to extract the long key for comparison
-
parallelSortByFloat
Sorts the specified array based on the float values extracted by the providedToFloatFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function used to extract the float key for comparison
-
parallelSortByFloat
public static <T> void parallelSortByFloat(List<? extends T> list, ToFloatFunction<? super T> keyExtractor) Sorts the specified list based on the float values extracted by the providedToFloatFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function used to extract the float key for comparison
-
parallelSortByDouble
Sorts the specified array based on the double values extracted by the providedToDoubleFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function used to extract the double key for comparison
-
parallelSortByDouble
public static <T> void parallelSortByDouble(List<? extends T> list, ToDoubleFunction<? super T> keyExtractor) Sorts the specified list based on the double values extracted by the providedToDoubleFunctionby multiple threads.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function used to extract the double key for comparison
-
reverseSort
public static void reverseSort(boolean[] a) Sorts the specified array of booleans in reverse order.- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Sorts the specified range of the array of booleans in reverse order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
reverseSort
public static void reverseSort(char[] a) Sorts the specified array of characters in reverse order.- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(char[] a, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the array of characters in reverse order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSort
public static void reverseSort(byte[] a) Sorts the specified array of bytes in reverse order.- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(byte[] a, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the array of bytes in reverse order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSort
public static void reverseSort(short[] a) Sorts the specified array of shorts in reverse order.- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(short[] a, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the array of shorts in reverse order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSort
public static void reverseSort(int[] a) Sorts the specified array of ints in reverse order.- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(int[] a, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the array of ints in reverse order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSort
public static void reverseSort(long[] a) Sorts the specified array of longs in reverse order.- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(long[] a, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the array of longs in reverse order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSort
public static void reverseSort(float[] a) Sorts the specified array of floats in reverse order.- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(float[] a, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the array of floats in reverse order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSort
public static void reverseSort(double[] a) Sorts the specified array of doubles in reverse order.- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(double[] a, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the array of doubles in reverse order.- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSort
Sorts the specified array of objects in reverse order. (wherenullis maximum)- Parameters:
a- the array to be sorted
-
reverseSort
public static void reverseSort(Object[] a, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the array of objects in reverse order. (wherenullis maximum)- Parameters:
a- the array to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSort
Sorts the specified list in reverse order. (wherenullis maximum)- Type Parameters:
T-- Parameters:
list- the list to be sorted
-
reverseSort
public static <T extends Comparable<? super T>> void reverseSort(List<? extends T> list, int fromIndex, int toIndex) throws ArrayIndexOutOfBoundsException Sorts the specified range of the list in reverse order. (wherenullis maximum)- Type Parameters:
T-- Parameters:
list- the list to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
ArrayIndexOutOfBoundsException- if fromIndex or toIndex is out of range
-
reverseSortBy
public static <T,U extends Comparable<? super U>> void reverseSortBy(T[] a, Function<? super T, ? extends U> keyExtractor) Sorts the specified array based on the keys extracted by the providedFunctionin reverse order.- Type Parameters:
T- the type of elements in the arrayU- the type of keys extracted from the elements, which must be comparable- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the keys from the elements
-
reverseSortBy
public static <T,U extends Comparable<? super U>> void reverseSortBy(List<? extends T> list, Function<? super T, ? extends U> keyExtractor) Sorts the specified list based on the keys extracted by the providedFunctionin reverse order.- Type Parameters:
T- the type of elements in the listU- the type of keys extracted from the elements, which must be comparable- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the keys from the elements
-
reverseSortByInt
Sorts the specified array based on the int values extracted by the providedToIntFunctionin reverse order.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the int key from the elements
-
reverseSortByInt
public static <T> void reverseSortByInt(List<? extends T> list, ToIntFunction<? super T> keyExtractor) Sorts the specified list based on the int values extracted by the providedToIntFunctionin reverse order.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the int key from the elements
-
reverseSortByLong
Sorts the specified array based on the long values extracted by the providedToLongFunctionin reverse order.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the long key from the elements
-
reverseSortByLong
public static <T> void reverseSortByLong(List<? extends T> list, ToLongFunction<? super T> keyExtractor) Sorts the specified list based on the long values extracted by the providedToLongFunctionin reverse order.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the long key from the elements
-
reverseSortByFloat
Sorts the specified array based on the float values extracted by the providedToFloatFunctionin reverse order.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the float key from the elements
-
reverseSortByFloat
public static <T> void reverseSortByFloat(List<? extends T> list, ToFloatFunction<? super T> keyExtractor) Sorts the specified list based on the float values extracted by the providedToFloatFunctionin reverse order.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the float key from the elements
-
reverseSortByDouble
Sorts the specified array based on the double values extracted by the providedToDoubleFunctionin reverse order.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to be sortedkeyExtractor- the function to extract the double key from the elements
-
reverseSortByDouble
public static <T> void reverseSortByDouble(List<? extends T> list, ToDoubleFunction<? super T> keyExtractor) throws IndexOutOfBoundsException Sorts the specified list based on the double values extracted by the providedToDoubleFunctionin reverse order.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list to be sortedkeyExtractor- the function to extract the double key from the elements- Throws:
IndexOutOfBoundsException
-
binarySearch
public static int binarySearch(char[] a, char valueToFind) Performs a binary search on the specified array of characters to find the specified value. The array must be sorted (as by thesort(char[])method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
public static int binarySearch(char[] a, int fromIndex, int toIndex, char valueToFind) Performs a binary search on the specified range of the array of characters to find the specified value. The range must be sorted (as by thesort(char[], int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
public static int binarySearch(byte[] a, byte valueToFind) Performs a binary search on the specified array of bytes to find the specified value. The array must be sorted (as by thesort(byte[])method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
public static int binarySearch(byte[] a, int fromIndex, int toIndex, byte valueToFind) Performs a binary search on the specified range of the array of bytes to find the specified value. The range must be sorted (as by thesort(byte[], int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
public static int binarySearch(short[] a, short valueToFind) Performs a binary search on the specified array of shorts to find the specified value. The array must be sorted (as by thesort(short[])method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
public static int binarySearch(short[] a, int fromIndex, int toIndex, short valueToFind) Performs a binary search on the specified range of the array of shorts to find the specified value. The range must be sorted (as by thesort(short[], int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
public static int binarySearch(int[] a, int valueToFind) Performs a binary search on the specified array of ints to find the specified value. The array must be sorted (as by thesort(int[])method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
public static int binarySearch(int[] a, int fromIndex, int toIndex, int valueToFind) Performs a binary search on the specified range of the array of ints to find the specified value. The range must be sorted (as by thesort(int[], int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
public static int binarySearch(long[] a, long valueToFind) Performs a binary search on the specified array of longs to find the specified value. The array must be sorted (as by thesort(long[])method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
public static int binarySearch(long[] a, int fromIndex, int toIndex, long valueToFind) Performs a binary search on the specified range of the array of longs to find the specified value. The range must be sorted (as by thesort(long[], int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
public static int binarySearch(float[] a, float valueToFind) Performs a binary search on the specified array of floats to find the specified value. The array must be sorted (as by thesort(float[])method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
public static int binarySearch(float[] a, int fromIndex, int toIndex, float valueToFind) Performs a binary search on the specified range of the array of floats to find the specified value. The range must be sorted (as by thesort(float[], int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
public static int binarySearch(double[] a, double valueToFind) Performs a binary search on the specified array of doubles to find the specified value. The array must be sorted (as by thesort(double[])method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
public static int binarySearch(double[] a, int fromIndex, int toIndex, double valueToFind) Performs a binary search on the specified range of the array of doubles to find the specified value. The range must be sorted (as by thesort(double[], int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
Performs a binary search on the specified array of objects to find the specified value. The array must be sorted (as by thesort(Object[])method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
Performs a binary search on the specified range of the array of objects to find the specified value. The range must be sorted (as by thesort(Object[], int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
Performs a binary search on the specified array of objects to find the specified value. The array must be sorted (as by thesort(Object[], Comparator)method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched forcmp- the comparator by which the array is ordered- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - See Also:
-
binarySearch
public static <T> int binarySearch(T[] a, int fromIndex, int toIndex, T valueToFind, Comparator<? super T> cmp) Performs a binary search on the specified range of the array of objects to find the specified value. The range must be sorted (as by thesort(Object[], int, int, Comparator)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Type Parameters:
T- the type of the elements in the array- Parameters:
a- the array to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.cmp- the comparator by which the array is ordered- Returns:
- the index of the value to be searched, if it is contained in the array within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the array is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
public static <T extends Comparable<? super T>> int binarySearch(List<? extends T> list, T valueToFind) Performs a binary search on the specified list of objects to find the specified value. The list must be sorted (as by thesort(List)method) prior to making this call. If it is not sorted, the results are undefined. If the list contains multiple elements with the specified value, there is no guarantee which one will be found.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched for- Returns:
- the index of the value to be searched, if it is contained in the list within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the list is
nullor empty. - See Also:
-
binarySearch
public static <T extends Comparable<? super T>> int binarySearch(List<? extends T> list, int fromIndex, int toIndex, T valueToFind) Performs a binary search on the specified range of the list of objects to find the specified value. The range must be sorted (as by thesort(List, int, int)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.- Returns:
- the index of the value to be searched, if it is contained in the list within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the list is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
binarySearch
public static <T> int binarySearch(List<? extends T> list, T valueToFind, Comparator<? super T> cmp) Performs a binary search on the specified list of objects to find the specified value. The list must be sorted (as by thesort(List, Comparator)method) prior to making this call. If it is not sorted, the results are undefined. If the list contains multiple elements with the specified value, there is no guarantee which one will be found.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be searched. It must be sorted in ascending ordervalueToFind- the value to be searched forcmp- the comparator by which the list is ordered- Returns:
- the index of the value to be searched, if it is contained in the list within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the list is
nullor empty. - See Also:
-
binarySearch
public static <T> int binarySearch(List<? extends T> list, int fromIndex, int toIndex, T valueToFind, Comparator<? super T> cmp) Performs a binary search on the specified range of the list of objects to find the specified value. The range must be sorted (as by thesort(List, int, int, Comparator)method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.- Type Parameters:
T- the type of the elements in the list- Parameters:
list- the list to be searched. It must be sorted in ascending order.fromIndex- the index of the first element (inclusive) to be searched.toIndex- the index of the last element (exclusive) to be searched.valueToFind- the value to be searched for.cmp- the comparator by which the list is ordered- Returns:
- the index of the value to be searched, if it is contained in the list within the specified range;
otherwise, (-(insertion point) - 1), or -1 if the list is
nullor empty. - Throws:
IndexOutOfBoundsException- if the range is out of bounds.- See Also:
-
indexOf
public static int indexOf(boolean[] a, boolean valueToFind) Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(boolean[] a, boolean valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(char[] a, char valueToFind) Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(char[] a, char valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(byte[] a, byte valueToFind) Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(byte[] a, byte valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(short[] a, short valueToFind) Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(short[] a, short valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(int[] a, int valueToFind) Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(int[] a, int valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(long[] a, long valueToFind) Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(long[] a, long valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(float[] a, float valueToFind) Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(float[] a, float valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(double[] a, double valueToFind) Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(double[] a, double valueToFind, int fromIndex) Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
public static int indexOf(double[] a, double valueToFind, double tolerance) Finds the index of the given value within a given tolerance in the array. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns
INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
a- the array to search through for the object, may benullvalueToFind-tolerance- tolerance of the search- Returns:
- the index of the value within the array,
INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
public static int indexOf(double[] a, double valueToFind, double tolerance, int fromIndex) Finds the index of the given value in the array starting at the given index. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns
INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return
INDEX_NOT_FOUND(-1).- Parameters:
a- the array to search through for the object, may benullvalueToFind-tolerance- tolerance of the searchfromIndex- the index to start searching at- Returns:
- the index of the value within the array,
INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
Returns the index of the first occurrence of the specified value in the array.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched for- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain the value
-
indexOf
Returns the index of the first occurrence of the specified value in the array, starting the search at the specified index.- Parameters:
a- the array to be searchedvalueToFind- the value to be searched forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified value in the array,
or -1 if the array is
nullor empty or does not contain
-
indexOf
Returns the index of the first occurrence of the specified value in the specified collection.- Parameters:
valueToFind- the value to be searched fora- the collection to be searched- Returns:
- the index of the first occurrence of the specified value in the collection,
or -1 if the collection is
nullor empty or does not contain the value
-
indexOf
Returns the index of the first occurrence of the specified value in the specified collection, starting the search at the specified index.- Parameters:
valueToFind- the value to be searched forfromIndex- the index to start the search froma- the collection to be searched- Returns:
- the index of the first occurrence of the specified value in the collection,
or -1 if the collection is
nullor empty or does not contain the value
-
indexOf
Returns the index of the first occurrence of the specified value in the given iterator.- Parameters:
iter- The iterator to be searched.valueToFind- The value to find in the iterator.- Returns:
- The index of the first occurrence of the specified value in the iterator, or -1 if the value is not found.
- Throws:
ArithmeticException- If the foundindexoverflows an int.- See Also:
-
indexOf
public static int indexOf(Iterator<?> iter, Object valueToFind, int fromIndex) throws ArithmeticException Returns the index of the first occurrence of the specified value in the given iterator, starting the search from the specified index.- Parameters:
iter- The iterator to be searched.valueToFind- The value to find in the iterator.fromIndex- The index to start the search from.- Returns:
- The index of the first occurrence of the specified value in the iterator, or -1 if the value is not found.
- Throws:
ArithmeticException- If the foundindexoverflows an int.- See Also:
-
indexOfSubList
Returns the starting position of the first occurrence of the specified sublist within the source list.- Parameters:
sourceList- the list to search withinsubListToFind- the sublist to search for- Returns:
- the starting position of the first occurrence of the specified sublist, or -1 if there is no such occurrence
- See Also:
-
indexOfSubList
Returns the starting position of the first occurrence of the specified sublist within the source list, starting the search at the specified index.- Parameters:
sourceList- the list to search withinsubListToFind- the sublist to search forfromIndex- the index to start the search from- Returns:
- the starting position of the first occurrence of the specified sublist, or -1 if there is no such occurrence
- Throws:
IndexOutOfBoundsException- if the starting index is out of range- See Also:
-
indexOfIgnoreCase
Returns the index of the first occurrence of the specified string in the array, ignoring case considerations.- Parameters:
a- the array to search withinvalueToFind- the string to search for- Returns:
- the index of the first occurrence of the specified string, or -1 if there is no such occurrence
-
indexOfIgnoreCase
Returns the index of the first occurrence of the specified string in the array, ignoring case considerations, starting the search at the specified index.- Parameters:
a- the array to search withinvalueToFind- the string to search forfromIndex- the index to start the search from- Returns:
- the index of the first occurrence of the specified string, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(boolean[] a, boolean valueToFind) Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(boolean[] a, boolean valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(char[] a, char valueToFind) Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(char[] a, char valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(byte[] a, byte valueToFind) Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(byte[] a, byte valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(short[] a, short valueToFind) Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(short[] a, short valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(int[] a, int valueToFind) Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(int[] a, int valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(long[] a, long valueToFind) Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(long[] a, long valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(float[] a, float valueToFind) Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(float[] a, float valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(double[] a, double valueToFind) Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(double[] a, double valueToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
public static int lastIndexOf(double[] a, double valueToFind, double tolerance) Finds the last index of the given value within a given tolerance in the array. This method will return the index of the last value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns
INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
a- the array to search through for the object, may benullvalueToFind-tolerance- tolerance of the search- Returns:
- the index of the value within the array,
INDEX_NOT_FOUND(-1) if not found ornullarray input
-
lastIndexOf
public static int lastIndexOf(double[] a, double valueToFind, double tolerance, int startIndexFromBack) Finds the last index of the given value in the array starting at the given index. This method will return the index of the last value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns
INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return
INDEX_NOT_FOUND(-1). A startIndex larger than the array length will search from the end of the array.- Parameters:
a- the array to traverse for looking for the object, may benullvalueToFind-tolerance- search for value within plus/minus this amountstartIndexFromBack- the start index to traverse backwards from- Returns:
- the last index of the value within the array,
INDEX_NOT_FOUND(-1) if not found ornullarray input
-
lastIndexOf
Returns the index of the last occurrence of the specified value in the array.- Parameters:
a- the array to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
Returns the index of the last occurrence of the specified value in the array, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
Returns the index of the last occurrence of the specified value in the specified collection.- Parameters:
c- the collection to search withinvalueToFind- the value to search for- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOf
Returns the index of the last occurrence of the specified value in the specified collection, starting the search backwards from the specified index.- Parameters:
c- the collection to search withinvalueToFind- the value to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified value, or -1 if there is no such occurrence
-
lastIndexOfSubList
Returns the index of the last occurrence of the specified sublist in the source list.- Parameters:
sourceList- the list to search withinsubListToFind- the sublist to search for- Returns:
- the index of the last occurrence of the specified sublist, or -1 if there is no such occurrence
-
lastIndexOfSubList
public static int lastIndexOfSubList(List<?> sourceList, List<?> subListToFind, int startIndexFromBack) Returns the index of the last occurrence of the specified sublist in the source list, starting the search backwards from the specified index.- Parameters:
sourceList- the list to search withinsubListToFind- the sublist to search forstartIndexFromBack- the index to start the search from.- Returns:
- the index of the last occurrence of the specified sublist, or -1 if there is no such occurrence
- See Also:
-
lastIndexOfIgnoreCase
Returns the index of the last occurrence of the specified string in the array, ignoring case considerations.- Parameters:
a- the array to search withinvalueToFind- the string to search for- Returns:
- the index of the last occurrence of the specified string, or -1 if there is no such occurrence
-
lastIndexOfIgnoreCase
Returns the index of the last occurrence of the specified string in the array, ignoring case considerations, starting the search backwards from the specified index.- Parameters:
a- the array to search withinvalueToFind- the string to search forstartIndexFromBack- the index to start the search from- Returns:
- the index of the last occurrence of the specified string, or -1 if there is no such occurrence
-
findFirstIndex
Finds the index of the first element in the array that matches the given predicate.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to search withinpredicate- the predicate to apply to elements of the array- Returns:
- an OptionalInt containing the index of the first matching element, or an empty OptionalInt if no match is found
-
findFirstIndex
public static <T,U> u.OptionalInt findFirstIndex(T[] a, U u, BiPredicate<? super T, ? super U> predicate) Finds the index of the first element in the array that matches the given predicate.- Type Parameters:
T- the type of elements in the arrayU- the type of the second argument to the predicate- Parameters:
a- the array to search withinu- the second argument to the predicatepredicate- the predicate to apply to elements of the array- Returns:
- an OptionalInt containing the index of the first matching element, or an empty OptionalInt if no match is found
-
findFirstIndex
public static <T> u.OptionalInt findFirstIndex(Collection<? extends T> c, Predicate<? super T> predicate) Finds the index of the first element in the collection that matches the given predicate.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to search withinpredicate- the predicate to apply to elements of the collection- Returns:
- an OptionalInt containing the index of the first matching element, or an empty OptionalInt if no match is found
-
findFirstIndex
public static <T,U> u.OptionalInt findFirstIndex(Collection<? extends T> c, U u, BiPredicate<? super T, ? super U> predicate) Finds the index of the first element in the collection that matches the given predicate.- Type Parameters:
T- the type of elements in the collectionU- the type of the second argument to the predicate- Parameters:
c- the collection to search withinu- the second argument to the predicatepredicate- the predicate to apply to elements of the collection- Returns:
- an OptionalInt containing the index of the first matching element, or an empty OptionalInt if no match is found
-
findLastIndex
Finds the index of the last element in the array that matches the given predicate.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to search withinpredicate- the predicate to apply to elements of the array- Returns:
- an OptionalInt containing the index of the last matching element, or an empty OptionalInt if no match is found
-
findLastIndex
public static <T,U> u.OptionalInt findLastIndex(T[] a, U u, BiPredicate<? super T, ? super U> predicate) Finds the index of the last element in the array that matches the given predicate.- Type Parameters:
T- the type of elements in the arrayU- the type of the second argument to the predicate- Parameters:
a- the array to search withinu- the second argument to the predicatepredicate- the predicate to apply to elements of the array- Returns:
- an OptionalInt containing the index of the last matching element, or an empty OptionalInt if no match is found
-
findLastIndex
public static <T> u.OptionalInt findLastIndex(Collection<? extends T> c, Predicate<? super T> predicate) Finds the index of the last element in the collection that matches the given predicate.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to search withinpredicate- the predicate to apply to elements of the collection- Returns:
- an OptionalInt containing the index of the last matching element, or an empty OptionalInt if no match is found
-
findLastIndex
public static <T,U> u.OptionalInt findLastIndex(Collection<? extends T> c, U u, BiPredicate<? super T, ? super U> predicate) Finds the index of the last element in the collection that matches the given predicate.- Type Parameters:
T- the type of elements in the collectionU- the type of the second argument to the predicate- Parameters:
c- the collection to search withinu- the second argument to the predicatepredicate- the predicate to apply to elements of the collection- Returns:
- an OptionalInt containing the index of the last matching element, or an empty OptionalInt if no match is found
-
indicesOfAllMin
Returns the indices of all minimum elements in the specified array.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to search within- Returns:
- an array of indices of all minimum elements. An empty array if the input array is empty.
-
indicesOfAllMin
Returns the indices of all minimum elements in the specified array using the provided comparator.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to search withincmp- the comparator to compare elements of the array- Returns:
- an array of indices of all minimum elements. An empty array if the input array is empty.
-
indicesOfAllMin
public static <T extends Comparable<? super T>> int[] indicesOfAllMin(Collection<? extends T> c) throws IllegalArgumentException Returns the indices of all minimum elements in the specified collection.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to search within- Returns:
- an array of indices of all minimum elements. An empty array if the input collection is empty.
- Throws:
IllegalArgumentException
-
indicesOfAllMin
public static <T> int[] indicesOfAllMin(Collection<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException Returns the indices of all minimum elements in the specified collection using the provided comparator.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to search withincmp- the comparator to compare elements of the collection- Returns:
- an array of indices of all minimum elements. An empty array if the input collection is empty.
- Throws:
IllegalArgumentException
-
indicesOfAllMax
public static <T extends Comparable<? super T>> int[] indicesOfAllMax(T[] a) throws IllegalArgumentException Returns the indices of all maximum elements in the specified array.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to search within- Returns:
- an array of indices of all maximum elements. An empty array if the input array is empty.
- Throws:
IllegalArgumentException
-
indicesOfAllMax
public static <T> int[] indicesOfAllMax(T[] a, Comparator<? super T> cmp) throws IllegalArgumentException Returns the indices of all maximum elements in the specified array using the provided comparator.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to search withincmp- the comparator to compare elements of the array- Returns:
- an array of indices of all maximum elements. An empty array if the input array is empty.
- Throws:
IllegalArgumentException
-
indicesOfAllMax
public static <T extends Comparable<? super T>> int[] indicesOfAllMax(Collection<? extends T> c) throws IllegalArgumentException Returns the indices of all maximum elements in the specified collection.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to search within- Returns:
- an array of indices of all maximum elements. An empty array if the input collection is empty.
- Throws:
IllegalArgumentException
-
indicesOfAllMax
public static <T> int[] indicesOfAllMax(Collection<? extends T> c, Comparator<? super T> cmp) throws IllegalArgumentException Returns the indices of all maximum elements in the specified collection using the provided comparator.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to search withincmp- the comparator to compare elements of the collection- Returns:
- an array of indices of all maximum elements. An empty array if the input collection is empty.
- Throws:
IllegalArgumentException
-
indicesOfAll
Returns the indices of all occurrences of the specified value in the given array.- Parameters:
a- the array to search withinvalueToFind- the value to find in the array- Returns:
- an array of indices of all occurrences of the specified value
-
indicesOfAll
Returns the indices of all occurrences of the specified value in the given array, starting the search from the specified index.- Parameters:
a- the array to search withinvalueToFind- the value to find in the arraystartIndex- the index to start the search from- Returns:
- an array of indices of all occurrences of the specified value
-
indicesOfAll
Returns the indices of all occurrences of the specified value in the specified collection.- Parameters:
c- the collection to search withinvalueToFind- the value to find in the collection- Returns:
- an array of indices of all occurrences of the specified value
-
indicesOfAll
Returns the indices of all occurrences of the specified value in the specified collection, starting the search from the specified index.- Parameters:
c- the collection to search withinvalueToFind- the value to find in the collectionstartIndex- the index to start the search from- Returns:
- an array of indices of all occurrences of the specified value
-
indicesOfAll
Returns the indices of all elements in the specified array that match the given predicate.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to search withinpredicate- the predicate to apply to elements of the array- Returns:
- an array of indices of all elements that match the predicate. An empty array if the input array is empty.
-
indicesOfAll
Returns the indices of all elements in the specified array that match the given predicate, starting the search from the specified index.- Type Parameters:
T- the type of elements in the array- Parameters:
a- the array to search withinpredicate- the predicate to apply to elements of the arraystartIndex- the index to start the search from- Returns:
- an array of indices of all elements that match the predicate. An empty array if the input array is empty.
-
indicesOfAll
Returns the indices of all elements in the specified collection that match the given predicate.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to search withinpredicate- the predicate to apply to elements of the collection- Returns:
- an array of indices of all elements that match the predicate. An empty array if the input collection is empty.
-
indicesOfAll
public static <T> int[] indicesOfAll(Collection<? extends T> c, Predicate<? super T> predicate, int fromIndex) Returns the indices of all elements in the specified collection that match the given predicate, starting the search from the specified index.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection to search withinpredicate- the predicate to apply to elements of the collectionstartIndex- the index to start the search from- Returns:
- an array of indices of all elements that match the predicate. An empty array if the input collection is empty.
-
isTrue
Returnstrueif the specifiedbooleanisBoolean.TRUE, notnullorBoolean.FALSE.- Parameters:
bool- the Boolean to check- Returns:
trueif the Boolean isBoolean.TRUE,falseotherwise
-
isNotTrue
Returnstrueif the specifiedbooleanisnullorBoolean.FALSE.- Parameters:
bool- the Boolean to check- Returns:
trueif the Boolean isnullorBoolean.FALSE,falseotherwise
-
isFalse
Returnstrueif the specifiedbooleanisBoolean.FALSE, notnullorBoolean.TRUE.- Parameters:
bool- the Boolean to check- Returns:
trueif the Boolean isBoolean.FALSE,falseotherwise
-
isNotFalse
Returnstrueif the specifiedbooleanisnullorBoolean.TRUE.- Parameters:
bool- the Boolean to check- Returns:
trueif the Boolean isnullorBoolean.TRUE,falseotherwise
-
negate
Note: copied from Apache commons Lang under Apache license v2.0
Negates the specified boolean.
If
nullis passed in,nullwill be returned.NOTE: This returns
nulland will throw a NullPointerException if autoboxed to a boolean.BooleanUtils.negate(Boolean.TRUE) = Boolean.FALSE; BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE; BooleanUtils.negate(null) = null;
- Parameters:
bool- the Boolean to negate, may be null- Returns:
- the negated Boolean, or
nullifnullinput
-
negate
Negates all elements in the specified boolean array.- Parameters:
a- the boolean array to negate
-
negate
@Beta public static void negate(boolean[] a, int fromIndex, int toIndex) throws IndexOutOfBoundsException Negates all elements in the specified range of the boolean array.- Parameters:
a- the boolean array to negatefromIndex- the starting index (inclusive) of the range to negatetoIndex- the ending index (exclusive) of the range to negate- Throws:
IndexOutOfBoundsException- if the specified range is out of bounds
-
unmodifiableCollection
Returns an unmodifiable view of the specified collection, or an immutable/unmodifiable empty collection if the specified collection isnull.- Type Parameters:
T- the type of elements in the collection- Parameters:
c- the collection for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified collection, or an immutable/unmodifiable empty collection if the specified collection is null
-
unmodifiableList
Returns an unmodifiable view of the specified list, or an immutable/unmodifiable empty list if the specified list isnull.- Type Parameters:
T- the type of elements in the list- Parameters:
list- the list for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified list, or an immutable/unmodifiable empty list if the specified list is null
-
unmodifiableSet
Returns an unmodifiable view of the specified set, or an immutable/unmodifiable empty set if the specified set isnull.- Type Parameters:
T- the type of elements in the set- Parameters:
s- the set for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified set, or an immutable/unmodifiable empty set if the specified set is null
-
unmodifiableSortedSet
Returns an unmodifiable view of the specified sorted set, or an immutable/unmodifiable empty sorted set if the specified sorted set isnull.- Type Parameters:
T- the type of elements in the set- Parameters:
s- the sorted set for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified sorted set, or an immutable/unmodifiable empty sorted set if the specified sorted set is null
-
unmodifiableMap
Returns an unmodifiable view of the specified map, or an immutable/unmodifiable empty map if the specified map isnull.- Type Parameters:
K- the type of keys in the mapV- the type of values in the map- Parameters:
m- the map for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified map, or an immutable/unmodifiable empty map if the specified map is null
-
unmodifiableSortedMap
Returns an unmodifiable view of the specified sorted map, or an immutable/unmodifiable empty sorted map if the specified map isnull.- Type Parameters:
K- the type of keys in the mapV- the type of values in the map- Parameters:
m- the sorted map for which an unmodifiable view is to be returned- Returns:
- an unmodifiable view of the specified sorted map, or an immutable/unmodifiable empty sorted map if the specified map is null
-
checkElementIndex(int,int)instead